prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
he License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or im...
{ if (!bus->rail_ctl_fn) { return; } prv_rail_ctl(bus, false); // Drain through pull-ups OutputConfig out_scl = { .gpio = bus->scl_gpio.gpio, .gpio_pin = bus->scl_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_scl, GPIO_PuPd_NOPULL, GPIO_Speed_2MHz); gpio_output_set(&out_sc...
//! Configure bus pins for use by I2C peripheral //! Lock bus and peripheral config access before configuring pins static void prv_bus_pins_cfg_i2c(I2CBus *bus) { gpio_af_init(&bus->scl_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); gpio_af_init(&bus->sda_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuP...
path) { record_mock_call(s_gpath_draw_filled) { .path.num_points = path->num_points, }; memcpy(s_gpath_draw_filled.last_call.path.points, path->points, sizeof(path->points[0]) * path->num_points); } void graphics_fill_rect(GContext *ctx, const GRect *rect) {} void graphics_fill_round_rect_by_value...
(8.5, 9.5)
, s_graphics_line_draw_precise_stroked.last_call.pp0); cl_assert_equal_point_precise(PP(10.5, 11.5), s_graphics_line_draw_precise_stroked.last_call.pp1); EXECUTE_SCRIPT( "ctx.fill();\n" ); // only first shape has at least 3 points cl_assert_equal_i(1, s_gpath_draw_filled.call_count); MockCallRecording ...
__receive_player_playback_info_update(void) { prv_connect_ams(); // Receive: playing, 200% playback rate, elapsed time 184.755s // 0000 00 01 00 31 2c 32 2e 30 2c 31 38 34 2e 37 35 35 ...1,2.0 ,184.755 uint8_t playback_info_update[] = { 0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30, 0x2c, 0x31, 0x...
prv_receive_entity_update(volume_update, sizeof(volume_update))
; cl_assert_equal_i(music_get_volume_percent(), 0); } // Tests: Receiving Track updates /////////////////////////////////////////////////////////// void test_ams__receive_track_artist_update(void) { prv_connect_ams(); // 0000 02 00 00 4d 69 6c 65 73 20 44 61 76 69 73 ...Miles Davis uint8_t track_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
i2c_write_register(I2C_LED, register_address, value)
; } // used to bring hardware shutdown pin on led controller low, this brings down our shutdown current static void prv_shutdown(bool shutdown) { periph_config_acquire_lock(); gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, !shutdown); periph_config_release_lock(); } static void prv_init_pins(void) { periph_conf...
/* * 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...
battery_critical_get_app_info()
; } if (low_power_is_active()) { return low_power_face_get_app_info(); } if (launcher_panic_get_current_error() != 0) { return panic_app_get_app_info(); } return launcher_menu_app_get_app_info(); } //! @return True if the currently running app is an installed watchface static bool prv_current_ap...
sizeof(incomplete_put_msg)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_sent_while_previous_put_was_not_acked_yet(void) { uint8_t max_put_ops = prv_put_bytes_get_max_batched_pb_ops(); prv_receive_init(VALID_OBJECT_SIZE * max_put_ops, Object...
(~s_last_response_cookie)
cache_key); #if !CAPABILITY_HAS_GLYPH_BITMAP_CACHING // If we don't have bitmap caching, the keyed_circular_cache entry cannot store the bitmap. // Therefore, we need to copy the matched entry into `glyph_buffer` which does have the space // to store the bitmap. if (cached) { memcpy(font_cache->gl...
// compressed glyphs are the only case where the metadata gets modified. // The only time the data is cooked is when loading a bitmap and the glyph is compressed, in // which case the `num_rle_units` field is turned back into `height_px`. keyed_circular_cache_push(&font_cache->line_cache, cache_key, data); /...
static void prv_check_font_cache(FontCache *font_cache, const FontResource *font_res) { // Invalidate the offset table if (font_cache->cached_font != font_res) { font_cache->offset_table_id = -1; font_cache->cached_font = font_res; } } static bool prv_load_font_res(ResAppNum app_num, uint32_t resource_...
e; static bool s_accel_outstanding_motion_work = false; static bool s_accel_outstanding_data_work = false; static bool s_fifo_overrun_detected = false; // Forward declarations static void prv_configure_operating_mode(void); static void prv_bma255_IRQ1_handler(bool *should_context_switch); static void prv_bma255_IRQ2_...
prv_conv_raw_to_12bit(&buf[i*2])
; } const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; *data = (AccelDriverSample) { .x = (cfg->axes_inverts[AXIS_X] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_X]]), .y = (cfg->axes_inverts[AXIS_Y] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_Y...
, BITS(4)); cl_assert_equal_i(0b00111111, BITS_BETWEEN(0, 5)); cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128...
(system_flash_write( FLASH_BASE + 10, testdata, sizeof(testdata), callback_is_called_cb, (void *)8675309))
96, -768}, { 184, 696, -768}, { 184, 688, -768}, { 184, 696, -776}, { 184, 696, -768}, { 176, 696, -768}, { 184, 704, -776}, { 192, 696, -760}, { 184, 704, -768}, { 192, 696, -776}, { 192, 696, -784}, { 192, 688, -768}, { 192, 688, -776}, { 192, 688, -776}, { 192,...
{ 184, 688, -776}, { 184, 688, -776}, { 184, 688, -784}, { 184, 688, -768}, { 184, 696, -784}, { 184, 688, -776}, { 184, 688, -784}, { 184, 688, -776}, { 184, 696, -776}, { 184, 696, -776}, { 184, 688, -784}, { 184, 688, -776}, { 192, 688, -784}, { 192, 688, -784}...
{ 128, 432, -960}, { 8, 392, -928}, { 184, 272, -968}, { 192, 256, -984}, { 208, 208, -968}, { 184, 184, -968}, { 136, 376, -1000}, // 215 seconds { 112, 360, -1016}, { 112, 424, -984}, { 96, 400, -960}, { 80, 432, -968}, { 40, 480, -936}, { 40, 504, -920}, {...
orWhite; } } return bitmap; } bool gbitmap_init_with_resource(GBitmap* bitmap, uint32_t resource_id) { ResAppNum app_resource_bank = sys_get_current_resource_num(); return gbitmap_init_with_resource_system(bitmap, app_resource_bank, resource_id); } GBitmap *gbitmap_create_with_resource(uint32_t resource_i...
applib_resource_munmap_or_free(data)
/ MI/KM units string const char *units_string = active_window->workout_controller->get_distance_string( i18n_noop("MI"), i18n_noop("KM")); GTextNodeText *units_text_node = health_util_create_text_node_with_text( i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container); ...
i18n_noop("KM/H")
); GTextNodeText *units_text_node = health_util_create_text_node_with_text( i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container); units_text_node->node.offset.y = units_offset_y; #endif break; } // don't have default here so when we have a new type, we don't forget ...
he License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specifi...
menu_layer_get_selected_index(&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...
cl_assert(isnan(log(-1.0)))
; cl_assert(log(0) == -HUGE_VAL); cl_assert(isnan(log(NAN))); cl_assert(isinf(log(INFINITY))); }
_t ids[NumBlobDBs]; uint8_t num_ids; blob_db_get_dirty_dbs(ids, &num_ids); cl_assert_equal_i(num_ids, 0); cl_assert(blob_db_get_dirty_list(BlobDBIdTest) == NULL); // insert one char *key = "key"; char *value = "value"; cl_assert_equal_i(S_SUCCESS, blob_db_insert(BlobDBIdTest, ...
(extra_keys)
; ++i) { blob_db_insert(BlobDBIdTest, (uint8_t *)extra_keys[i], key_len, (uint8_t *)extra_values[i], value_len); } prv_generate_responses_from_phone(); cl_assert_equal_i(s_num_writebacks, 7); } void test_blob_db_sync__sync_some(void) { char *keys[] = { "key1", "key2", "key3", "key4", "...
888}, { 208, -352, -856}, { 216, -320, -872}, { 224, -312, -848}, { 224, -360, -848}, { 216, -312, -872}, { 184, -272, -896}, { 168, -312, -888}, { 176, -320, -864}, { 192, -320, -880}, { 208, -336, -880}, { 208, -312, -880}, { 208, -328, -864}, { 200, -352, -872}, ...
{ 88, 216, -904}, { 48, 152, -800}, { -136, 392, -1096}, { -136, 392, -848}, { -16, 760, -704}, { 16, 720, -664}, { 0, 624, -696}, { 16, 624, -688}, { 0, 616, -704}, { -8, 560, -712}, { 16, 608, -704}, { 8, 592, -696}, { 48, 544, -688}, { 40, 688, -664}, { 48,...
{ 200, 200, -712}, { 208, 320, -840}, { 176, 256, -920}, // 5 seconds { 176, 40, -952}, { 168, -56, -1008}, { 88, -24, -1088}, { 72, 272, -856}, { 112, 280, -904}, { 128, 328, -896}, { 136, 240, -880}, { 136, 240, -888}, { 128, 208, -888}, { 112, 216, -928}, ...
de "system/logging.h" #include "syscall/syscall.h" #include "syscall/syscall_internal.h" #include "system/passert.h" #include "util/net.h" #include "util/pack.h" #include "util/uuid.h" #define RESOURCE_MAX_SIZE (700) //! Autogenerated table created by generate_resource_code.py as part of resource generation. The //! ...
if (res_id != RESOURCE_ID_INVALID) { const AppResourceInfo res_info = (AppResourceInfo) { .res_app_num = res_app_num, .res_id = res_id, }; if (prv_is_app_published_resource_valid(&res_info)) { if (res_info_out) { *res_info_out = res_info; } return true...
} return false; } void timeline_resources_get_id(const TimelineResourceInfo *timeline_res, TimelineResourceSize size, AppResourceInfo *res_info_out) { PBL_ASSERTN(timeline_res && res_info_out && (size < TimelineResourceSizeCount)); // Test the high bit to determine if system r...
ODEL("pebble_time_round_silver_20mm"); break; case WATCH_INFO_COLOR_TIME_ROUND_BLACK_20: model_name = SPALDING_MODEL("pebble_time_round_black_20mm"); break; case WATCH_INFO_COLOR_TIME_ROUND_ROSE_GOLD_14: model_name = SPALDING_MODEL("pebble_time_round_rose_gold_14mm"); ...
rocky_get_or_create_object(rocky, ROCKY_WATCHINFO, rocky_creator_object, NULL, &was_created)
; PBL_ASSERTN(was_created); prv_fill_watchinfo(watchinfo); } const RockyGlobalAPI WATCHINFO_APIS = { .init = prv_init_apis, };
ion); cl_assert_equal_i(s_num_requested_notif_attributes, 1 ); cl_assert_equal_i(s_num_ds_notifications_received, 1); ns_notification.uid = comple_dict_uid; prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 2); cl_a...
prv_send_notification_with_event_flags((uint8_t *)&s_mms_no_caption_dict, EventFlagMultiMedia)
; prv_cmp_last_received_notification(&s_mms_no_caption_parsed_item); // Test an MMS with a caption prv_send_notification_with_event_flags((uint8_t *)&s_mms_with_caption_dict, EventFlagMultiMedia); prv_cmp_last_received_notification(&s_mms_with_caption_parsed_item); // Test a third party notification with th...
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * Se...
{ PBL_LOG(LOG_LEVEL_WARNING, "CDONE not high after programming!"); return false; }
return true; } void display_power_enable(void) { // The display requires us to wait 1ms between each power rail coming up. The PMIC // initialization brings up the 3.2V rail (VLCD on the display, LD02 on the PMIC) for us, but // we still need to wait before turning on the subsequent rails. delay_ms(2); P...
s = bma255_selftest(); if (pass) { PBL_LOG(LOG_LEVEL_DEBUG, "BMA255 self test pass, all 3 axis"); } else { PBL_LOG(LOG_LEVEL_ERROR, "BMA255 self test failed one or more axis"); } // Workaround to fix FIFO Frame Leakage: Disable temperature sensor (we're not using it anyways) // See Section 2.2.1 of h...
accel_get_sampling_interval()
; uint8_t fifo_status = bma255_read_register(BMA255Register_FIFO_STATUS); BMA255_DBG("Drain %"PRIu8" samples", num_samples_available); const uint8_t num_samples_available = fifo_status & 0x3f; if (num_samples_available == 0) { return; } bma255_prepare_txn(BMA255Register_FIFO_DATA | BMA255_READ_FLAG);...
rocky_add_constructor(void) { static const RockyGlobalAPI *s_api[] = { NULL, }; rocky_global_init(s_api); JS_VAR prototype = rocky_add_constructor("test", test_func_imp); cl_assert_equal_b(jerry_value_is_object(prototype), true); EXECUTE_SCRIPT("_rocky.test();"); cl_assert_equal_i(1, s_test_func_imp_...
cl_assert(jerry_get_number_value(result_date) == 17.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...
{ // All events other than SmartstrapConnectionEvent contain the attribute pointer SmartstrapAttribute *attr = event.attribute; PBL_ASSERTN(attr); if ((event.type == SmartstrapDataSentEvent) && state->handlers.did_write) { state->handlers.did_write(attr, event.result); } else if ((event.type =...
} // Subscription functions //////////////////////////////////////////////////////////////////////////////// static bool prv_should_subscribe(void) { // We don't need to subscribe until either the app creates an attribute or subscribes an // availability_did_change handler. SmartstrapConnectionState *state = ...
/* * 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...
PBL_LOG(LOG_LEVEL_ALWAYS, "LR: %p. Incorrect task! Expected <%s> got <%s>", (void*) saved_lr, pebble_task_get_name(expected_task), pebble_task_get_name(pebble_task_get_current()))
; trigger_fault(RebootReasonCode_Assert, saved_lr); } } void passert_check_not_task(PebbleTask unexpected_task) { uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0); if (pebble_task_get_current() == unexpected_task) { PBL_LOG(LOG_LEVEL_ALWAYS, "LR: %p. Incorrect task! Can't be <%s>", ...
, 12:00:00 { 9,-1,12,-1, WDAY_ANY, 1475323200}, //////// wday time finding // now, -Th // 2015 Nov 13, 00:00:00 { -1,-1,-1,-1, WDAY_ANY & ~WDAY_THURSDAY, 1447372800}, // now, -Th-Fr // 2015 Nov 14, 00:00:00 { -1,-1,-1,-1, WDAY_ANY & ~(WDAY_THURSDAY|WDAY_FRIDAY), 1447459200}, // now, -Th-Fr-Sa // 2...
{ // Dec 20th, 02:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 0, .hour = 2, .mday = 19, .month = 11, .may_be_instant = true, }; // 2015 Dec 20, 02:00:00 GMT time_t advance = 1450576800 - s_2015_dec19_123456_gmt; prv_basic_test(&s_ti...
void test_cron__dst_hole_to(void) { // NOTE: This behavior is SUPER weird, and it could change in the future. // A failure in this test is not necessarily a problem. // Nov 20th, 02:30:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 2, ....
oor: return "Poor"; case HRMQuality_Acceptable: return "Acceptable"; case HRMQuality_Good: return "Good"; case HRMQuality_Excellent: return "Excellent"; } WTF; } static char *prv_translate_error(AppMessageResult result) { switch (result) { case APP_MSG_OK: return "APP_MSG_...
(hrm->bpm.quality)
); layer_mark_dirty(&app_data->window.layer); bpm = hrm->bpm.bpm; bpm_quality = hrm->bpm.quality; } else if (hrm->event_type == HRMEvent_LEDCurrent) { led_current = hrm->led.current_ua; } else if (hrm->event_type == HRMEvent_Diagnostics) { if (!app_data->ready_to_send) { r...
ics_draw_text(&gcontext, "\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(&gcontext, "\n\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(&gcontext, "\1\n", font, box, GTextOverflow...
(attributes->font, NULL)
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); animation_...
cl_assert_equal_i(s_num_destructor_calls, 1)
; test_reel = NULL; } void test_kino_player__set_reel_does_not_call_destructor(void) { test_player->owns_reel = false; kino_player_set_reel(test_player, test_reel, false); cl_assert_equal_p(test_player->reel, test_reel); cl_assert_equal_i(s_num_destructor_calls, 0); kino_player_set_reel(test_player, NUL...
zer__destroy(void) { bool impl_destroyed = false; s_test_impl_data.destroyed = &impl_destroyed; bool sub_destroyed = false; Recognizer *r = test_recognizer_create(&s_test_impl_data, &sub_destroyed); test_recognizer_enable_on_destroy(); recognizer_set_on_destroy(r, prv_sub_destroy); // can't destroy a re...
(last_touch_event.type, TouchEvent_Touchdown)
; cl_assert_equal_b(updated, false); new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Liftoff }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Completed)...
} uint8_t *png_data = malloc((size_t)file_size); if (!png_data) { goto cleanup; } // Go back to the start of the file and read it into the buffer if (fseek(fp, 0L, SEEK_SET) != 0) { goto cleanup; } cl_assert_equal_i(fread(png_data, 1, file_size, fp), file_size); // Creat...
(test_image_filename)
; cl_assert(bitmap); cl_assert(gbitmap_get_format(bitmap) == test_data->expected_test_image_bitmap_format); // Draw the two variations of the test image at GPointZero prv_composite_test_draw_bitmap(&s_ctx, bitmap, GPointZero, compositing_mode); // Then redraw the two variations offset so the botto...
SYNC_DONE_RESPONSE_LENGTH = 3; static bool s_b2db_accepting_messages; T_STATIC BlobDBToken prv_new_token(void) { static BlobDBToken next_token = 1; // 0 token should be avoided return next_token++; } static const uint8_t *prv_read_token_and_response(const uint8_t *iter, BlobDBToken *out_token, ...
(LOG_LEVEL_ERROR, "Got a writeback response with an invalid length: %"PRIu32"", length)
; return; } prv_handle_wb_write_response(data, length); } static void prv_handle_sync_done_response(CommSession *session, const uint8_t *data, uint32_t length) { if (length < SYNC_DONE_RESPONSE_LENGTH) { PBL_LOG(LOG_LEVE...
s_data.is_first_half ? 0 : -end; const int16_t to = s_data.is_first_half ? end : 0; return interpolate_int16(normalized_progress, from, to); } // Draws the shutters based on the path definitions static void prv_draw_shutter(GContext *ctx, uint32_t distance, bool vertical) { graphics_context_set_antialiased(ctx, ...
{ prv_draw_in(ctx, s_small_movement_size, progress, direction_vertical, /*invert*/ draw_shutter ? direction_vertical : true); }
; cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id)); cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID)); } void test_app_install_manager__is_from_system(void) { cl_assert_equal_b(true, app_install_id_from_system(-1000000)); cl_assert_equal_b(true, app_install_id_from_system(-1)); cl_asse...
app_install_unmark_prioritized(sports_id)
; cl_assert(true == app_install_entry_is_hidden(&entry)); // simulates multiple messages from app for (int i = 0; i < 10; i++) { // visible after communication app_install_mark_prioritized(sports_id, true /* can_expire */); cl_assert(false == app_install_entry_is_hidden(&entry)); } // wait 10 mi...
read consumer set. PBL_ASSERTN(!is_notify || (s_read_consumer.profile == SmartstrapProfileInvalid)); // this frame is valid - transition the FSM and queue up processing of it smartstrap_fsm_state_set(SmartstrapStateReadComplete); ReadCompleteContext context = { .success = true, .is_notify =...
(mbuf_iterator_read_byte(iter, &read_data))
; if (mbuf_is_flag_set(mbuf, MBUF_FLAG_IS_FRAMING)) { result = prv_send_byte_and_check(read_data); } else { result = prv_send_byte(read_data); } if (mbuf_iterator_is_finished(iter)) { // we just sent the last byte if (s_send_info.is_read) { // We just successfully sent a read request, so ...
L; head = list_insert_before(head, &a); cl_assert(head == &a); head = list_insert_before(&b, &a); cl_assert(head == &a); } void test_list__pop_head(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL; list_insert_after(&a, &b); ListNode *new_head = list_pop_head(&b); cl_assert(new_head == &b); cl...
{ bar[i].value = i; tail = list_append(tail, &bar[i].list_node); }
atchNode *prv_find_stopwatch_node(DialogAnalyticsMetric metric) { return (AnalyticsStopwatchNode *)list_find( s_stopwatch_list, prv_compare_stopwatch, (void *)(uintptr_t)metric); } static void prv_add_stopwatch(DialogAnalyticsMetric metric, uint32_t count_per_sec) { AnalyticsStopwatchNode *stopwatch = kernel_m...
kernel_free(head)
; } s_stopwatch_list = NULL; while (s_analytics_list) { ListNode *head = s_analytics_list; list_remove(head, &s_analytics_list, NULL); kernel_free(head); } s_analytics_list = NULL; mutex_destroy((PebbleMutex *)s_analytics_lock); }
lient->reassembly_ctx.buffer, data, length) != 0); } static uint8_t prv_current_command_id(const uint8_t* data) { return ((const CPDSMessage *)data)->command_id; } static bool prv_reassembly_is_complete(const uint8_t* data, const size_t length, bool* out_error) { switch (prv_current_command_id(data)) { case C...
if (!complete || error) { PBL_LOG(LOG_LEVEL_WARNING, "Error parsing app attributes"); goto fail; }
// cache the app name ANCSAttribute *app_id = s_ancs_client->attributes[FetchedNotifAttributeIndexAppID]; ANCSAttribute *app_name = app_attrs[FetchedAppAttributeIndexDisplayName]; ancs_app_name_storage_store(app_id, app_name); fail: prv_put_ancs_message(app_attrs); prv_reset_and_next(); } // -----------...
/* * 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...
(&chip_id)
; PBL_LOG(LOG_LEVEL_DEBUG, "Chip ID='%s', ts=%"PRIu32", pkg=0x%"PRIx8", wafer=%"PRIu8", x=%"PRIu8", y=%"PRIu8"", chip_id.chip_id, chip_id.info.timestamp, chip_id.info.package_type, chip_id.info.wafer_number, chip_id.info.x_coord, chip_id.info.y_coord); } /** * @brief System Initializat...
/ indicated from the middle, therefore initialised with 0 (as middle) and // radius_y (as scalines are on y axis) int draw_min = 0; int draw_max = radius_outer_y.integer; // Adjust to drawing_box offset int adjusted_center = center.y.integer + ctx->draw_state.drawing_box.origin.y; // We add one to comp...
{ y_middle.integer++; prv_get_angles_mask_edge(y_middle, center, config.start_quadrant.quadrant, &starting_edge, &ending_edge, start_top, start_bottom); prv_get_angles_mask_edge(y_middle, center, config.end_quadrant.quadrant, &en...
} int16_t outer_edge = prv_get_ellipsis_border(y, radius_outer_y_sq, radius_outer_x_sq).raw_value; int16_t left = center.x.raw_value - outer_edge; int16_t right = center.x.raw_value + outer_edge; if (!no_innner_ellipsis && radius_inner_y.integer != 0) { // This complicates the situation ...
assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 1); cl_assert_equal_b(s_radius, 0); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert(prv_compare_points(&center, s_stroke_points, s...
(s_path_stroke_count, 0)
; cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert_equal_i(s_circle_fill_count, 1); prv_reset(); gdraw_command_list_get_command(command_list, 1)->hidden = true; gdraw_command_list_draw(ctx, command_list); cl_assert_equal_i(s_path_stroke_count, 0); cl_asser...
/* * 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; }
const uint32_t total_duration = gdraw_command_sequence_get_total_duration(sequence); const uint32_t elapsed = interpolate_uint32(distance_normalized, 0, total_duration); GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, elapsed); if (!frame) { return; } // Original SVG...
/* * 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...
(processed_command)
///////////////////////////////////////////////////////////////////////////////// // app_inbox_service_write / app_inbox_service_end static const uint8_t s_test_data[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x1...
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1))
; cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // No space: cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE + 1, s_writer)); // Shouldn't call ..._end() here because ..._begin() failed. ...
OUT 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 "comm/ble/kernel_le_client/ancs/ancs.h" #include "comm/ble/kernel_le_client/ancs/ancs_types.h" #include "comm/ble/kernel_le_client/a...
buffer_add(b, s_chunked_dict_part_one, sizeof(s_chunked_dict_part_one))
, sizeof(s_chunked_dict_part_one)); cl_assert_equal_i(buffer_add(b, s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two)), sizeof(s_chunked_dict_part_two)); bool error = false; cl_assert(ancs_util_is_complete_notif_attr_response(b->data, b->bytes_written, &error)); cl_assert(!error); ANCSAttribute *attr...
", payload->ppogatt_max_rx_window, payload->ppogatt_max_tx_window); client->out.tx_window_size = MIN(client->out.tx_window_size, payload->ppogatt_max_rx_window); client->out.rx_window_size = MIN(client->out.rx_window_size, payload->ppogatt_max_tx_window); } } PBL_LOG(LOG_LEVEL_DEBUG,...
UNLIKELY(packet->type >= PPoGATTPacketTypeInvalidRangeStart)
) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid type %u", packet->type); return; } if (UNLIKELY(packet->type) == PPoGATTPacketTypeResetRequest) { PBL_LOG(LOG_LEVEL_INFO, "Got reset request!"); prv_handle_reset_request(client); return; } if (LIKELY(client->state == StateConnectedOpen)) { if (LIKELY...
turn; } slave->slave_state->initialized = true; slave->slave_state->acquired = false; slave->slave_state->scs_selected = false; prv_spi_bus_init(slave->spi_bus, prv_is_bidrectional(slave)); // SCS gpio_output_init(&slave->spi_scs, GPIO_OType_PP, slave->spi_bus->spi_sclk_speed); gpio_output_set(&slave->...
(slave->slave_state->acquired)
{ 1160, 160, -152}, { 1008, 240, -184}, { 1096, 224, -248}, { 1216, 280, -232}, { 1208, 208, -160}, { 1112, 136, -192}, { 1000, 112, -128}, { 616, -128, -88}, { 648, -96, -112}, { 648, -72, -256}, { 880, 16, -376}, // 10 seconds { 1400, 152, -464}, { 1456, 216, -42...
// 15 seconds { 1512, 288, -632}, { 1320, 208, -416}, { 1192, 760, -784}, { 960, 56, -352}, { 1392, 216, -496}, { 1280, 288, -600}, { 1152, 648, -656}, { 992, 992, -856}, { 848, 688, -648}, { 984, 1016, -568}, { 1048, 864, -480}, { 1248, 568, -336}, { 1416, 416, -...
{ 776, 112, -168}, { 856, 152, -192}, { 920, 144, -248}, { 904, 104, -248}, { 984, 96, -288}, { 744, -64, -344}, { 824, -16, -200}, { 664, 24, -320}, { 992, 144, -472}, { 1424, 224, -528}, // 18 seconds { 1160, 80, -328}, { 832, 120, -376}, { 808, 216, -368}, ...
int16_t value); static void prv_update_cell_for_long_label_scrolling_animation_state( ActionMenuLayer *aml, ActionMenuLayerLongLabelScrollingAnimationState state) { const bool item_animation_is_valid = (aml && aml->item_animation.animation); if (item_animation_is_valid) { ActionMenuItemAnimation *item_anim...
(content_size, root_level, selected_index, additional_crumbs)
; } } static void prv_render_action_menus_static( SettingsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs) { const int16_t x_offset = GRID_CELL_PADDING + (content_size * (GRID_CELL_PADDING + DISP_COLS)); s_ctx.draw_state.drawing...
0) }, }, .cache_set = false, }; if (prv_menu_layer_get_header_height(menu_layer, 0) != 0) { // We have to add the separator height, as when drawing down -> up, we render the separator // for the row above before proceeding down. We only render this separator at the top if we // have head...
animation_set_auto_destroy(a1, true)
; // Step 2. Skip the top of the highlight down to the top of the newly selected cell, // and have the selection BOTTOM_DOWN_PX below the selected cell. from.origin.y = menu_layer->selection.y - ((up) ? BOTTOM_DOWN_PX : 0); from.size.h = size.h + BOTTOM_DOWN_PX; // Step 3. Bring up the bottom of the highlig...
present = false; s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 84, .distance_m = 1234, .avg_pace = health_util_get_pace(84, 1234), .bpm = 71, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySessionType_Walk, &s_w...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
{ const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1 }; Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; const uint8_t gradient_width = (x2 - x1) / 6; x2_fixed.integer -= gradient_width; prv_assign_horizontal_line_delta_raw(&ctx->dest_bitmap, y, x1_fixed, x2_fixed, gradient_width, ...
{ GColor color = (GColor) { .argb = y * max_rgb_value / (bitmap_bounds.size.h - 1) }; color.a = 3; // 100% opacity ctx.draw_state.stroke_color = color; for (int x = 0; x < bitmap_bounds.size.w / 2; x++) { const GPoint point = GPoint(x, y); set_pixel_raw_8bit(&ctx, point); } }
// Replicate the last column of the colored gradient for the remaining columns of the bitmap prv_replicate_column_row_raw(&ctx.dest_bitmap, (bitmap_bounds.size.w / 2) - 1, (bitmap_bounds.size.w / 2), bitmap_bounds.size.w ...
_SDK_VERSION_MINOR) typedef struct LauncherAppGlanceGeneric { //! The title that will be displayed char title_buffer[APP_NAME_SIZE_BYTES]; //! The icon that will be displayed KinoReel *displayed_icon; //! The resource info of the displayed icon AppResourceInfo displayed_icon_resource_info; //! The resour...
{ res_info_to_load = generic_glance->default_icon_resource_info; }
const bool legacy_icon_size_limit = generic_glance->use_legacy_28x28_icon_size_limit; // Try loading the requested icon generic_glance->displayed_icon = prv_create_glance_icon(&res_info_to_load, legacy_icon_size_limit); if (!generic_glance->displayed_...
fer, int buf_size, time_t timestamp) { if (buffer && s_test_data.timestamp) { strncpy(buffer, s_test_data.timestamp, (size_t)buf_size); buffer[buf_size - 1] = '\0'; } } void clock_get_until_time(char *buffer, int buf_size, time_t timestamp, int max_relative_hrs) { if (buffer && s_test_data.reminder_times...
impl->accessors.setter.grect(animation->subject, animation->values.from.grect)
; } if (to_frame) { animation->values.to.grect = *to_frame; } return (PropertyAnimation *)animation; } // Helper Functions ///////////////////// #include "../graphics/test_graphics.h" #include "../graphics/util.h" // Setup and Teardown //////////////////////////////////// // To easily render multiple wi...
er rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_...
DEG_TO_TRIGANGLE(0)
, GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_color, ...
x81, 0x81, 0x3c, 0x66, 0x42, 0xc3, 0xe7, 0xff, 0x00, 0x00, 0x00}; uint32_t gothic_18_emoji_handle = RESOURCE_ID_GOTHIC_18_EMOJI; cl_assert(text_resources_init_font(0, gothic_18_emoji_handle, 0, &s_font_info)); uint8_t glyph_size_bytes; const GlyphData *glyph; const Codepoint PHONE_CODEPOINT = 0x260E; gly...
(&s_font_cache, codepoint, &s_font_info)
; cl_assert(glyph); unsigned glyph_size = sizeof(GlyphHeaderData) + glyph_get_size_bytes(glyph); memcpy(glyph_buffer, glyph->data, glyph_size); glyph = text_resources_get_glyph(&s_font_cache, codepoint, &font_info_compressed); cl_assert(glyph); cl_assert_equal_m(glyph->data, glyph...
/* * 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 (!event_try_put_from_process(task, event)) { PBL_LOG(LOG_LEVEL_WARNING, "%s: From app queue is full! Dropped %p! Killing App", (task == PebbleTask_App ? "App" : "Worker"), event); syscall_failed(); } }
DEFINE_SYSCALL(void, sys_send_pebble_event_to_kernel, PebbleEvent* event) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(event, sizeof(*event)); } PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_App || task == PebbleTask_Worker) { prv_put_event_from_process(task, ...
(x1 + num_pixels_per_mask_value - 1); record_func(ctx, y, x1, x2, src_color); } } cl_assert(graphics_context_mask_record(ctx, NULL)); test_graphics_context_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // RECORDING VERTICAL LINE HELPERS...
{ test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, GPoint(x, y)); }
} return mask; } typedef void (*HorizontalClippingMaskApplyFunc)(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color); static void prv_mask_apply_hline_test_pattern(HorizontalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_prepare_ca...
184, -64}, { 920, 168, -104}, { 1016, 104, -56}, { 976, 8, -112}, { 776, -64, -160}, { 976, -48, 80}, { 1312, 216, -24}, { 1432, 280, -208}, { 1784, 360, -80}, { 1576, 400, -120}, { 1048, 320, -264}, { 952, 424, -128}, { 1048, 192, 24}, { 1248, 376, -32}, { 1144,...
{ 1536, 176, 48}, { 1504, 248, -184}, { 1480, 256, -152}, { 1384, 264, -136}, { 1064, 280, -320}, { 880, 288, -360}, { 768, 296, -184}, { 864, 304, -64}, { 1064, 384, -152}, { 1136, 416, -216}, { 1296, 432, -168}, { 1376, 480, -168}, { 1016, 480, -104}, { 1104, 52...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_ERROR, "Pointer %p not in app or microflash region", string)
; syscall_failed(); } } return i18n_get_length(string); }
/* * 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...
(item->header.timestamp, 30)
; timeline_item_destroy(item); } void test_timeline_api__pin_two_items(void) { TimelineItem *item1 = timeline_item_create_with_attributes(30, 0, TimelineItemTypePin, LayoutIdTest, NULL, NULL); fake_rtc_increment_ticks(1); TimelineItem *item2 = timeline_item_create_with_attributes(40, 0, TimelineItemTypePin...
verning permissions and * limitations under the License. */ #include "clar.h" #include "test_jerry_port_common.h" #include "test_rocky_common.h" #include "applib/rockyjs/api/rocky_api_global.h" #include "applib/rockyjs/api/rocky_api_datetime.h" #include "applib/rockyjs/pbl_jerry_port.h" // Standard #include <strin...
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {minute: '2-digit'});")
; ASSERT_JS_GLOBAL_EQUALS_S("s", "04"); s_clock_is_24h_style = false; EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {hour: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "8 PM"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: 'numeric', hour12: true});"); ASSERT_JS_GLO...
// Return semaphore token so another transfer can be started semaphore_give(bus); // Wait for bus to to clear the busy flag before a new transfer starts // Theoretically a transfer could complete successfully, but the busy flag never clears, // which would cause the next transfer to fail if (!wait_for_busy_...
{ case TRANSFER_STATE_WRITE_ADDRESS_TX: // Write the i2c device address to the bus to select it in write mode. bus->i2c->DR = bus->transfer.device_address & ~I2C_READ_WRITE_BIT; bus->transfer.state = TRANSFER_STATE_WRITE_REG_ADDRESS; break; case TRANSFER_STATE_WRITE_REG_ADDRESS: /...
case TRANSFER_STATE_READ_DATA: bus->transfer.data[bus->transfer.idx] = bus->i2c->DR; bus->transfer.idx++; if (bus->transfer.idx + 1 == bus->transfer.size) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; } ...
_usb_connected_raw(void) { return false; } void low_power_standby(void) { s_entered_standby = true; } void low_power_exit(void) { s_in_low_power = false; } void low_power_enter(void) { s_in_low_power = true; } bool low_power_is_active(void) { return s_in_low_power; } bool firmware_update_is_in_progress(v...
(high_mv, true, true)
; battery_monitor_init(); periodic_timer_trigger(1); // For the first sample, it will be identical cl_assert_equal_i(battery_get_charge_state().charge_percent, high_percent); // ...and should stay that way periodic_timer_trigger(10); cl_assert_equal_i(battery_get_charge_state().charge_percent, high_perc...
e specific language governing permissions and * limitations under the License. */ #include "codepoint.h" #include "util/size.h" #include <stddef.h> #define MAX_LATIN_CODEPOINT 0x02AF #define MIN_SOFTBANK_EMOJI_CODEPOINT 0xE000 #define MAX_SOFTBANK_EMOJI_CODEPOINT 0xE537 #define MIN_UNIFIED_EMOJI_CODEPOINT 0x1F300...
{ return ((codepoint >= MIN_SOFTBANK_EMOJI_CODEPOINT && codepoint <= MAX_SOFTBANK_EMOJI_CODEPOINT) || (codepoint >= MIN_UNIFIED_EMOJI_CODEPOINT && codepoint <= MAX_UNIFIED_EMOJI_CODEPOINT)); }
} bool codepoint_is_special(const Codepoint codepoint) { return (codepoint >= MIN_SPECIAL_CODEPOINT && codepoint <= MAX_SPECIAL_CODEPOINT); }
/* * 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...
{ // Reset & (re)initialize the flash HW flash_impl_init(true /* coredump_mode */); // Protect the PRF region from writes flash_impl_write_protect( FLASH_REGION_SAFE_FIRMWARE_BEGIN, (FLASH_REGION_SAFE_FIRMWARE_END - SECTOR_SIZE_BYTES)); }
-194}, { 690, -247, -481}, { 598, -379, -551}, { 690, -196, -309}, { 795, -387, -446}, { 730, -344, -511}, { 719, -491, -849}, { 610, -350, -1137}, { 922, -411, -1651}, { 1629, -509, -805}, { 2026, -119, -435}, { 1259, 253, -320}, { 814, 17, -218}, { 713, -529, -192},...
{ 829, 32, -577}, { 803, -10, -657}, { 817, -35, -646}, { 802, -103, -666}, { 809, -213, -612}, { 796, -228, -646}, { 777, -333, -613}, { 697, -349, -590}, { 698, -365, -598}, { 608, -380, -580}, { 554, -329, -481}, { 423, -529, -657}, { 762, -356, -1060}, { 1103,...
{ 1298, 263, -462}, { 1156, 448, -264}, { 859, 499, 270}, { 711, 730, -11}, { 572, 300, -66}, { 507, 180, -196}, { 607, 915, -480}, { 877, 541, -70}, { 966, 570, -164}, { 900, 601, -67}, { 786, 603, -41}, { 880, 532, 25}, { 964, 505, 53}, { 931, 577, -19}, { ...
struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = 0, .tm_mday = 2, // 2015/01/02 .tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of the year .tm_gmtoff = 0, .tm_isdst = 0, .tm_zone = "UTC", // No DST, UTC+0 }; struct tm jan_1_...
(tmbuf, "UTC %")
; } extern size_t localized_strftime(char* s, size_t maxsize, const char* format, const struct tm* tim_p, const char *locale); void test_strftime__i18n(void) { char tmbuf[512]; struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = ...
/* * 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...
(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST)
; // Schedule again wakeup_id = sys_wakeup_schedule(sys_get_time() + 10, 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10); // Cancel all wakeup events sys_wakeup_cancel_all_for_app(); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test_wakeup__max_e...
5); cl_assert_fixedS16_3(radius, 4); r = GRect(2, 2, 8, 8); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 5.5, 5.5); cl_assert_fixedS16_3(radius, 3.5); } void test_graphics_circle__grect_polar_calc_values_mode(void) { GPointPrecise center = {}; Fixed_S16_3 radius ...
cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE), 360)
; cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE), -360); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_PI / 2), 90); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_PI / 2), -90); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE / 2), 180); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE / 2), -180); cl_asse...
revert = prv_create_int16_prop_anim(min, max, stage_duration, &s_animated_dot_impl, data); if (!revert) { goto cleanup; } Animation *sequence = animation_sequence_create((Animation *)expand, (Animation *)shrink, (Animation *) revert, NULL); if (!sequence) { goto cleanup; } animation...
(data->mic_window.mic_dot_anim)
; animation_set_elapsed(data->mic_window.mic_dot_anim, START_ELAPSED); } static void prv_hide_mic_dot(VoiceUiData *data) { if (animation_is_scheduled(data->mic_window.mic_dot_anim)) { animation_unschedule(data->mic_window.mic_dot_anim); } layer_set_hidden(&data->mic_window.mic_dot_layer, true); } static v...
ude "util/size.h" #include <stdio.h> // helpers from accel manager extern void test_accel_manager_get_subsample_info( AccelManagerState *state, uint16_t *num, uint16_t *den, uint16_t *samps_per_update); extern void test_accel_manager_reset(void); // stub void event_service_init(PebbleEventType type, ...
cl_assert_equal_i(den, fastest_rate / gcd_of_rates)
; cl_assert_equal_i(samps_per_update, 1); } } cl_assert_equal_i(1000000 / s_sampling_interval_us, fastest_rate); cl_assert_equal_i(s_num_samples, 1); for (int i = 0; i < num_items; i++) { sys_accel_manager_data_unsubscribe(sessions[i]); stub_pebble_tasks_set_current(tasks[i]); } } // enum...
// the maximum Fast Mode clock speed. // When Fast Mode support is added the duty-cycle settings will probably have to be re-thought. PBL_ASSERT(bus->hal->clock_speed <= I2C_FAST_MODE_CLOCK_SPEED_MAX, "Fast Mode Plus not yet supported"); uint32_t duty_cycle_low = 1; uint32_t duty_cycle_high = 1...
if (remaining > UINT8_MAX) { cr2_value |= I2C_CR2_RELOAD; cr2_value |= I2C_CR2_NBYTES; } else { cr2_value |= (remaining << CR2_NBYTES_OFFSET) & I2C_CR2_NBYTES; }
if (generate_start) { cr2_value |= I2C_CR2_START; } bus->hal->i2c->CR2 = cr2_value; } void i2c_hal_start_transfer(I2CBus *bus) { prv_enable_interrupts(bus); if (bus->state->transfer.state == I2CTransferState_WriteRegAddress) { // For writes, we'll reload with the payload once we send the address. ...
alk session of 20 minutes long that starts 10 minutes in { memset(minute_raw_data, 0, k_minute_data_bytes); s_num_captured_activity_sessions = 0; time_t now = rtc_get_time(); int len = 20; KAlgTestActivitySession exp_session = { .activity = KAlgActivityType_Walk, .start_utc = now + 10...
prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session_walk)
; prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session_run); prv_feed_activity_minutes(minute_raw_data, k_minute_data_len); cl_assert_equal_i(s_num_captured_activity_sessions, 2); ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_se...
, hdr, sizeof(hdr)); } void pfs_command_fs_ls(void) { char display_buf[80]; int pages_in_use = 0; prompt_send_response("Page:\tFilename\tFile Size\tFile Info\tErase Count\n"); for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { PageHeader pg_hdr; FileHeader file_hdr; pg_hdr.page_flags = prv_get_...
(&free_page, start_page, active_sectors)
; // blow away the sector prv_handle_sector_erase(s_gc_block.gc_start_page, false); } void test_override_last_written_page(uint16_t start_page) { s_test_last_page_written_override = s_last_page_written; } #endif
_no_clip"))); // Even cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoi...
{ GContext ctx; test_graphics_context_init(&ctx, fb); // Test horizontal and vertical lines cross appropriately setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); // cross - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 10), 10); graphics_draw_horiz...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 76), 5); // T facing right - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(45, 75), 5); // T facing right - odd vert, even horiz graphics_draw_vertical_line_dotted(&...
ge is set to English. if (!pstring_equal_cstring(&app_id->pstr, IOS_MAIL_APP_ID)) { return false; } static const char loading_str[] = "Loading\xe2\x80\xa6"; if (pstring_equal_cstring(&message->pstr, loading_str)) { return true; } static const char no_content_str[] = "This message has no content."; ...
PBL_LOG(LOG_LEVEL_ERROR, "Can't handle notifications without an app id")
ttr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; // ALL DAY PIN static TimelineItem item6 = { .header = { .id = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 100*60, .duration = 10, .type = Timelin...
(!prv_get_calendar_ongoing())
(characteristics)
; if (s_ams_client->characteristics[0] != BLE_CHARACTERISTIC_INVALID) { PBL_LOG(LOG_LEVEL_WARNING, "Multiple AMS instances registered!?"); return; } // Keep around the BLECharacteristic references: memcpy(s_ams_client->characteristics, characteristics, sizeof(BLECharacteristic) * NumAMSCharac...
/* * 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...
((TaskHandle_t) context->task_handle)
; uint32_t control_reg = ulTaskDebugGetStackedControl((TaskHandle_t) context->task_handle); if ((control_reg & 0x1) == 0) { // We're priviledged, it's not safe to just kill the app task. vTaskResume((TaskHandle_t) context->task_handle); return false; } context->safe_to_kill = true; return true; ...
ic void prv_exit_and_send_result_event(VoiceUiData *data, DictationSessionStatus result) { VOICE_LOG("Send result"); PebbleEvent event = { .type = PEBBLE_DICTATION_EVENT, .dictation = { .result = result, .text = (result == DictationSessionStatusSuccess) ? data->message : NULL, .timestamp ...
if (data->show_error_dialog) { const GColor dialog_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); prv_push_error_dialog(data, i18n_noop("No internet connection"), RESOURCE_ID_CHECK_INTERNET_CONNECTION_LARGE, dialog_bg_color); data->error_exit_status = DictationSessionS...
} static void prv_handle_bt_conn_result(bool connected, void *context) { VoiceUiData *data = context; if (connected) { if (data->state == StateError) { // We got here after a dictation result timeout, so restart the dictation prv_start_dictation(data); } else { prv_voice_window_push(data...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const BitAction set = enable ? Bit_SET : Bit_RESET; gpio_use(BOARD_CONFIG.photo_en.gpio); GPIO_WriteBit(BOARD_CONFIG.photo_en.gpio, BOARD_CONFIG.photo_en.gpio_pin, set); gpio_release(BOARD_CONFIG.photo_en.gpio); }
void ambient_light_init(void) { s_sensor_light_dark_threshold = prv_get_default_ambient_light_dark_threshold(); periph_config_acquire_lock(); // Initialize light sensor enable { gpio_use(BOARD_CONFIG.photo_en.gpio); GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); ...
/* * 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...
(attr_list1, VEAttributeIdTranscription, sizeof(data1))
; cl_assert(attr1); cl_assert_equal_i(attr1->id, VEAttributeIdTranscription); cl_assert_equal_i(attr1->length, 0x2F); size_t offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute); cl_assert_equal_p(attr1->data, &data1[offset]); GenericAttribute *attr2 = generic_attribute_find_attribute(attr_list...
ropertyAnimation *result = property_animation_create(&s_dirty_layer_implementation, layer, NULL, NULL); return result; } // ----------------------------------------------------------------------------------------- void property_animation_destroy(PropertyAnimat...
memcpy(&property_animation->values.to, value, size)
ffset_px = 9; const uint16_t small_icon_offset = (icon_size.h < 60) ? 7 : 0; const uint16_t left_margin_px = PBL_IF_RECT_ELSE(5, 0); const uint16_t action_bar_width = show_action_bar ? ACTION_BAR_WIDTH : 0; const uint16_t content_and_action_bar_horizontal_spacing = PBL_IF_RECT_ELSE(left_margin_px, show_ac...
(text_layer, TEXT_FLOW_INSET_PX)
------------------------------------------------------------------- static void sleep_window_unload(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); text_layer_destroy(data->sleep_card.text_layer); data->sleep_card.text_layer = NULL; } // ---------------------------------------------...
APP_LOG(APP_LOG_LEVEL_DEBUG, "Got steps update event. (peek value: %d)", (int)peek_steps)
; data->cur_steps = peek_steps + data->steps_offset; steps_update_text(data); } else if (event == HealthEventSignificantUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got significant update event"); steps_update_text(data); } else if (event == HealthEventSleepUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "...
tic const uint16_t SMARTSTRAP_MAX_TIMEOUT = 1000; //! The header contains the version (1 byte), flags (4 bytes), and profile (2 bytes) fields //! The footer contains the checksum (1 byte) field #define FRAME_FOOTER_LENGTH 1 #define FRAME_MIN_LENGTH (sizeof(FrameHeader) + FRAME_FOOTER_LENGTH)...
new_timer_stop(s_read_timer)
ues(&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); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 4.5, 4.5); cl_assert_fixedS16_3(radius, 4.5); r = GRect(1, 1, 9, 9); grect_pola...
DEG_TO_TRIGANGLE(-180)
_type, -1); // Test that invalid state transitions get caught by asserts cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); r->state = RecognizerState_Possible; cl_assert_passert(recognizer_transition_stat...
(recognizer_set_failed(r))
/* * 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_update_conn_params(params->slave_latency_events, params->supervision_timeout_10ms)
; } void bluetooth_analytics_handle_connection_disconnection_event( AnalyticsEvent type, uint8_t reason, const BleRemoteVersionInfo *vers_info) { static uint32_t last_reset_counter_ticks = 0; static uint8_t num_events_logged = 0; const uint32_t ticks_per_hour = RTC_TICKS_HZ * 60 * 60; if ((rtc_get_ticks(...
nvic_channel(IRQn_Type irqn) { // Make sure we haven't already set up the channel in question. if (irqn == EXTI9_5_IRQn) { if (s_9_5_nvic_configured) { return; // Already configured } s_9_5_nvic_configured = true; } else if (irqn == EXTI15_10_IRQn) { if (s_15_10_nvic_configured) { retu...
{ NVIC_ClearPendingIRQ(EXTI9_5_IRQn); for (int i = 5; i <= 9; ++i) { prv_check_handle_exti(i); } }
void EXTI15_10_IRQHandler(void) { NVIC_ClearPendingIRQ(EXTI15_10_IRQn); for (int i = 10; i <= 15; ++i) { prv_check_handle_exti(i); } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERT_TASK(PebbleTask_KernelBackground)
; // make sure this request is able to be fulfilled smartstrap_state_lock(); const SmartstrapProfileInfo *info = prv_get_info_by_service_id(request->service_id); PBL_ASSERTN(info && info->send); if (!smartstrap_connection_has_subscriber() || !smartstrap_is_connected() || !smartstrap_link_control_is_prof...
e License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific...
((unsigned char)text.buffer[i])
; } // TODO: Don't return a struct return text; } static ClockModel prv_clock_model_default(struct tm *tick_time) { // Create a generic model and configure a default clock. ClockModel model; model.local_clock = prv_local_clock_face_default(tick_time); // Add watch-specific details. const WatchInfoCol...
/* * 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 (codepoint == 0) { break; }
if (!codepoint_is_formatting_indicator(codepoint)) { uint8_t c_len = utf8_copy_character(w_cursor, r_cursor, len); w_cursor += c_len; } r_cursor = next; } *w_cursor = '\0'; } void ancs_phone_call_handle_incoming(uint32_t uid, ANCSProperty properties, ...
at some point, if the connection ends up being unused. PBL_LOG(LOG_LEVEL_INFO, "No intent for connection"); bluetooth_analytics_handle_no_intent_for_connection(); } #if RECOVERY_FW // In PRF, stick to shortest connection interval indefinitely: conn_mgr_set_ble_conn_response_time(conne...
prv_intent_matches_connection(intent, connection)
partially // or completely clipped. next_line_y_extent = line_iter_state->current->origin.y; } return (next_line_y_extent > (text_box_params->box.origin.y + text_box_params->box.size.h)); } //! @return is_advanced bool line_iter_next(IteratorState state) { LineIterState* line_iter_state = (LineIterState...
(ctx, word, text_box_params, word->end)
; } return false; } // Trim int advance = prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, codepoint); PBL_ASSERTN(advance <= word->width_px); // Negative-length word not allowed word->width_px -= advance; word->start = utf8_iter_state->current; return true; } ...
rmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); // It's currently Thursday @ 00:00. The alarm shouldn't go off for over 2 days + 10:30 s_current_hour = 10; s_current_minute...
(s_num_timeline_adds, 1)
; } void test_alarm__recurring_weekday_alarm(void) { AlarmId id1, id2; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); // 2 pins should be added (for Thursday / Friday) cl_assert_...
R_INVALID_ID); } void test_calendar__init_with_future_event(void) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(!prv_get_calendar_ongoing()); TimerID ti...
(timeline_add(&item2))
; timeline_event_handle_blobdb_event(); cl_assert(timeline_add(&item3)); timeline_event_handle_blobdb_event(); cl_assert(timeline_add(&item4)); timeline_event_handle_blobdb_event(); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID ti...
atic bool prv_gbitmap_sequence_restart(GBitmapSequence *bitmap_sequence, bool reset_elapsed) { if (bitmap_sequence == NULL) { return false; } // can start seeking after SIG + IHDR int32_t metadata_bytes = png_seek_chunk_in_resource(bitmap_sequence->resource_id, ...
(upng, &bitmap_sequence->png_decoder_data.palette)
; if (bitmap_sequence->png_decoder_data.palette_entries == 0) { APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to load palette"); goto cleanup; } } bitmap_sequence->header_loaded = true; cleanup: applib_free(frame_data_buffer); // Free compressed image buffer if (!bitmap_sequence || !bitmap_sequen...
erState_Failed); // A touchdown occurs where no layers are touched while a window recognizer is active e.type = TouchEvent_Touchdown; s_active_layer = NULL; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) { 0 }, 1, &s_recognizers_handled); prv_compare_recogniz...
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive)
; cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); prv_destroy_recognizers(recognizers, ...
ry_job(connection); } } bt_unlock(); } static void prv_finalize_discovery(GAPLEConnection *connection, BTErrno errno) { if (errno != BTErrnoOK) { // Handle failure -- cleanup and dispatch event: prv_free_service_nodes(connection); gatt_client_subscriptions_cleanup_by_connection(connection, false ...
{ // Assuming "disconnection" reason is appropriate here: prv_finalize_discovery(connection, reason); bt_driver_gatt_handle_discovery_abandoned(); }
else { prv_free_service_nodes(connection); } } //! extern for gatt_service_changed.c //! Same as gatt_client_discovery_discover_all, but cleans up existing service discovery //! state and stops any existing service discovery process. BTErrno gatt_client_discovery_rediscover_all(const BTDeviceInternal *device) {...