prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
de <stdarg.h> #include <stdio.h> #include <stdlib.h> // Stubs /////////////////////////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h" // Tests /////////////////////////////////////////////////////////// void test_utf8__decode_test_string_valid(void) { static const int NUM...
cl_assert_equal_s((char *)dest, "")
conds { 264, 568, -600}, { 264, 680, -624}, { 264, 576, -584}, { 336, 592, -480}, { 352, 648, -520}, { 368, 552, -496}, { 320, 504, -352}, { 304, 696, -376}, { 232, 720, -328}, { 232, 704, -320}, { 208, 720, -344}, { 232, 736, -296}, { 264, 736, -272}, { 280, 848,...
{ -40, 936, 16}, { 40, 656, 312}, { 8, 1008, 144}, { -72, 1016, 360}, { -80, 1000, 208}, { -48, 848, 224}, // 8 seconds { -16, 760, 88}, { 8, 736, 112}, { 72, 688, 88}, { 96, 848, 72}, { 104, 760, 64}, { 128, 936, 96}, { 224, 912, -8}, { 248, 952, 24}, { 2...
{ 336, 808, 224}, { 368, 824, 240}, { 344, 808, 248}, { 336, 840, 216}, { 328, 800, 232}, { 352, 800, 200}, { 328, 824, 248}, { 304, 768, 288}, { 320, 848, 304}, { 312, 824, 312}, // 11 seconds { 328, 784, 328}, { 320, 792, 280}, { 320, 808, 272}, { 328, 808,...
ponse; #define REGISTER_BULKIO_HANDLER(domain_type, domain_id, vtable) \ extern PulseBulkIODomainHandler vtable; #include "pulse_bulkio_handler.def" #undef REGISTER_BULKIO_HANDLER static PulseBulkIODomainHandler * const s_domain_handlers[] = { #define REGISTER_BULKIO_HANDLER(domain_type, domain_id, vtable) \ ...
(prv_domain_read_cb, (void*)(uintptr_t)fd_num)
; } } else { pulse_reliable_send_cancel(resp); Command cmd = { .opcode = BULKIO_CMD_DOMAIN_READ, .read = { .fd = fd_num } }; prv_respond_internal_error(&cmd, sizeof(cmd), ret); } } static void prv_handle_open(Command *cmd, size_t length) { PulseBulkIODomainHandler ...
n an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "launcher_app_glance_structured.h" #include "launcher_app_glance_private.h" #include "launcher_menu_laye...
PBL_IF_COLOR_ELSE(GColorBlack, structured_glance->glance.is_highlighted ? GColorWhite : GColorBlack)
; } void launcher_app_glance_structured_draw_icon(LauncherAppGlanceStructured *structured_glance, GContext *ctx, KinoReel *icon, GPoint origin) { const GColor desired_tint_color = launcher_app_glance_structured_get_highlight_color(structured_glance); GenericGlan...
(len != sizeof(*hdr)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length"); return; } QEMU_LOG_DEBUG("Got bluetooth connection msg: connected:%d", hdr->connected); bool current_status = qemu_transport_is_connected(); bool new_status = (hdr->connected != 0); if (new_status != current_status && !bt_ct...
(s_qemu_endpoints)
; ++i) { const QemuMessageHandler* handler = &s_qemu_endpoints[i]; if (!handler || handler->protocol_id > protocol_id) { break; } if (handler->protocol_id == protocol_id) { return handler; } } return NULL; } // ---------------------------------------------------------------------...
_GET_RUN_SIZE(encoded); AccelRawData sample = (AccelRawData) { .x = ACTIVITY_RAW_SAMPLE_GET_X(encoded), .y = ACTIVITY_RAW_SAMPLE_GET_Y(encoded), .z = ACTIVITY_RAW_SAMPLE_GET_Z(encoded), }; while (run_size--) { cl_assert(num_samples > 0); *data++ = sample; ...
{ // Get the sleep sessions and make sure we get the expected ones stub_pebble_tasks_set_current(PebbleTask_App); uint32_t session_entries = 24; ActivitySession sessions[session_entries]; activity_get_sessions(&session_entries, sessions); cl_assert_equal_i(session_entries, exp_num_sessions); // Get the s...
// ============================================================================================= // Start of unit tests void test_activity__initialize(void) { TimezoneInfo tz_info = { .tm_zone = "UTC", .tm_gmtoff = 0, }; time_util_update_timezone(&tz_info); struct tm time_tm = s_init_time_tm; tim...
ken) + 1, "%d", &state->test_entry.activity_type.max); } else if (strcmp(token, "TEST_LEN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.value); } else if (strcmp(token, "TEST_LEN_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.min); ...
if (!state->ep) { // No more files return false; }
S OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "board/display.h" #include "drivers/periph_config.h" #include "drivers/gpio.h" #include "drivers/dbgserial.h" #include "util/attributes.h" #inclu...
GPIO_PinAFConfig(DISP_GPIO, DISP_PINSOURCE_SI, GPIO_AF_SPI2)
; // Init display GPIOs GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Init CS s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_PP; s_disp_gpio_init.GPIO_Pin = DISP_PIN_SCS; GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Init LCD Control s_disp_gpio_init.GPIO_Mode = GP...
clude "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_link_control.h" #include "services/normal/accessory/smartstrap_state.h" #include "syscall/syscall.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes...
(s_reserved_read_mbuf)
; s_reserved_read_mbuf = NULL; } PBL_LOG(LOG_LEVEL_DEBUG, "Sent service discovery message (result=%d)", result); } static void prv_set_connected(bool connected) { s_has_done_service_discovery = false; } static bool prv_handle_management_attribute_read(bool success, ManagementServiceAttribute attr, ...
ing permissions and * limitations under the License. */ #include "drivers/i2c_hal.h" #include "drivers/i2c_definitions.h" #include "drivers/stm32f7/i2c_hal_definitions.h" #include "drivers/stm32f7/i2c_timingr.h" #include "drivers/periph_config.h" #include "system/logging.h" #include "system/passert.h" #include "Fr...
if ((transfer->direction == I2CTransferDirection_Read) && (transfer->state != I2CTransferState_WriteRegAddress)) { cr2_value |= I2C_CR2_RD_WRN; }
const uint32_t remaining = bus->state->transfer.size - bus->state->transfer.idx; 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...
accel data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); } static void prv_drain_fifo(void) { // we can't drain the fifo if we are in low power mode so we have // to temporarily enter normal mode bool was_low_power = (s_accel_power_mode == BMI160_Accel_Mode_Low); if (was_low_power) { ...
exti_disable(BOARD_CONFIG_ACCEL.accel_ints[i])
; } prv_read_modify_write(BMI160_REG_INT_OUT_CTRL, int_cfg, int_mask); BMI160_DBG("INT_OUT_CTRL = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_OUT_CTRL)); } } void bmi160_init(void) { gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[0]); gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[1]); ex...
state, HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope) { PBL_ASSERTN(scope != HealthServiceTimeScopeOnce); // What day of the week is the scope for? For now, we will use the day of the week that // time_start falls on. In the future, we coul...
{ // No more data available more_data = false; break; }
// Update the metric from this new batch of data for (unsigned i = 0; (i < num_records) && (time_start < time_end); i++, time_start += SECONDS_PER_MINUTE) { if (minute_data[i].heart_rate_bpm == 0) { // Ignore minutes that have no heart rate BPM continue; } num_sample...
eof(core_dump_connect_response)) { return true; } } } // Pulse the INT line to wake the host host_transport_set_mcu_int(true); prv_timer_delay_1ms(); // The timer IRQ just fired so the counter won't be near roll-over host_transport_set_mcu_int(false); } return false; } ...
hw_watchdog_set_pos_val(0xFF)
; // Disable interrupts, should we not have been called from fault context portDISABLE_INTERRUPTS(); // Reconfig debug serial debug_uart_init(); printf("\n\nStarting Core Dump\n"); // Big problem if we re-enter here - it likely means we encountered and exception during // the core dump if (s_core_du...
ce *glance) { if (!service || !uuid || !glance) { return; } // If necessary, evict the LRU cache entry const uint32_t cache_entry_count = list_count(service->glance_cache); PBL_ASSERTN(cache_entry_count <= LAUNCHER_APP_GLANCE_SERVICE_CACHE_NUM_ENTRIES); if (cache_entry_count == LAUNCHER_APP_GLANCE_SERV...
{ return (LauncherAppGlanceCacheEntry *)list_find(service->glance_cache, prv_glance_cache_entry_find_cb, uuid); }
static LauncherAppGlance *prv_find_glance_in_cache(LauncherAppGlanceService *service, Uuid *uuid) { const LauncherAppGlanceCacheEntry *entry = prv_find_glance_entry_in_cache(service, uuid); return NULL_SAFE_FIELD_ACCESS(entry, glance, NULL); } //! Request a glance for an icon ID from an "MRU linked list" (list s...
sizeof(PebblePairingServiceInhibitBLESleep)) ? ATT_ERROR_OK : ATT_ERROR_INVALID_VALUE_LENGTH; break; default: rv = (att_error_t)PebblePairingServiceGATTError_UnknownCommandID; break; } finally: if (rv == ATT_ERROR_OK) { hc_endpoint_pebble_pairing_service_send_conn_params(connec...
(ble_gatts_add_descriptor(&uuid, ATT_PERM_RW, sizeof(uint16_t), enable_read_cb_flag, &ctx->att_hdl.conn_status_cccd) == BLE_STATUS_OK)
; // Trigger Pairing characteristic: prv_convert_uuid_to_little_endian( (const uint8_t[]){PEBBLE_BT_PAIRING_SERVICE_TRIGGER_PAIRING_UUID}, &uuid); PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_READ | GATT_PROP_WRITE, ATT_PERM_RW, sizeof(uint8_t), enable_rea...
prv_schedule_slide_animation(health_card_view, next_card_index, slide_up)
; } } // Select click handler static void prv_select_click_handler(ClickRecognizerRef recognizer, void *context) { HealthCardView *health_card_view = context; Layer *layer = health_card_view->card_layers[health_card_view->current_card_index]; s_card_view_select_click_handler[health_card_view->current_card_inde...
n prv_graphics_set_color(argc, argv, graphics_context_set_stroke_color); } JERRY_FUNCTION(prv_get_stroke_style) { return prv_graphics_get_color_string(rocky_api_graphics_get_gcontext()->draw_state.stroke_color); } JERRY_FUNCTION(prv_set_fill_style) { return prv_graphics_set_color(argc, argv, graphics_context_set_...
(ctx_prototype, ROCKY_CONTEXT2D_FILLSTYLE, prv_get_fill_style, prv_set_fill_style)
/* * 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...
(logging_session, (bool) empty_all_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...
(&RCC_ClocksStatus)
_log_consume(void) { DataLoggingSessionRef logging_sessions[10]; const int item_size = 1; // Create sessions for (int i = 0; i < 10; i++) { logging_sessions[i] = data_logging_create(i, DATA_LOGGING_UINT, item_size, false); cl_assert(logging_sessions[i]); fake_system_task_callbacks_invoke_pending();...
(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] = data_logging_create(i, DATA_LOGGING_UINT, item_size, false); cl_assert(logging_sessions[i]); fake_system_task_callbacks_invoke_pending(); prv_log_rand...
------------------------------------------------------------------------------------------------- // Interfaces towards Send Queue: static size_t prv_get_remaining_length(const SendBuffer *sb) { return (sizeof(PebbleProtocolHeader) + sb->written_length - sb->consumed_length); } static const uint8_t *prv_get_read_po...
{ // Wait for the sending process to free up some space in the send buffer: is_timeout = (xSemaphoreTake(s_default_kernel_sender_write_semaphore, remaining_ms) == pdFALSE); }
CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "app_install_manager.h" #include "app_install_manager_private.h" #include "app_custom_icon.h" #include "app_manager.h" #include "worker_manager.h" #...
{ // The recent app should eventually expire and we are still below the threshold rv = true; }
else if (!app->can_expire && app->last_activity != RECENT_APP_LAST_ACTIVITY_INVALID) { // The recent app should never expire and we haven't been manually expired yet. rv = true; } } } mutex_unlock_recursive(s_recent_apps.mutex); return rv; } void app_install_unmark_prioritized(AppInsta...
/* * 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 Uuid *searching_for_uuid = (const Uuid*)data; AnalyticsHeartbeatList *app_node = (AnalyticsHeartbeatList*)found_node; const Uuid *found_uuid = analytics_heartbeat_get_uuid(app_node->heartbeat); return uuid_equal(searching_for_uuid, found_uuid); }
static AnalyticsHeartbeatList *prv_app_node_create(const Uuid *uuid) { AnalyticsHeartbeatList *app_heartbeat_node = kernel_malloc_check(sizeof(AnalyticsHeartbeatList)); list_init(&app_heartbeat_node->node); app_heartbeat_node->heartbeat = analytics_heartbeat_app_create(uuid); return app_heartbeat_node; } c...
ata->core_ui_container); // Status bar status_bar_layer_init(&s_phone_ui_data->status_bar); layer_set_frame(&s_phone_ui_data->status_bar.layer, &GRect(0, 0, window->layer.bounds.size.w - PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH, 0), STATUS_BAR_LAYER_HEIGHT)); status_bar_laye...
prv_load_sms_reply_action(caller->number, source)
; } uint8_t actions = PhoneCallActions_Decline; if (can_reply) { actions |= PhoneCallActions_Reply; } if (can_answer) { actions |= PhoneCallActions_Answer; } prv_action_bar_setup(actions); prv_start_ringing(); } void phone_ui_handle_outgoing_call(PebblePhoneCaller *caller) { if (s_phone_ui_...
= GCornerBottomRight, }, { .filename_part = "quad_bottom_left", .mask = GCornerBottomLeft, }, { .filename_part = "quads_top", .mask = GCornersTop, }, { .filename_part = "quads_bottom", .mask = GCornersBottom, }, ...
(&ctx, fb)
; // Draw red circles with different alpha values in the stroke color with antialiasing disabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 0); graphics_context_set_stroke_color(&ctx, GColorRed); prv_draw_circles(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_...
(s_data.num_change_calls, 1)
; cl_assert_equal_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__did_change(void) { UnobstructedAreaHandlers handlers = { .did_change = prv_did_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOB...
gular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); ++secs_passed; } cl_assert(secs_passed < PPOGATT_TIMEOUT_TICKS); } // Simulate the regular timer firing a bunch of times to expire the timeout for the in-flight packets // This will trigger a retransmit of the un-acked packets for (int...
(s_characteristics[0][PPoGATTCharacteristicData])
; } void test_ppogatt__make_sure_timeout_reset_after_data_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); uint8_t num_packets = s_tx_window_size; // Get a packet in flight: for (int sn = 0; sn < num_packets; sn++) {...
ure(queue_type, saved_lr, event); #ifdef NO_WATCHDOG enable_mcu_debugging(); while (1); #endif reset_due_to_software_failure(); } return should_context_switch; } static bool prv_try_event_put(QueueHandle_t queue, PebbleEvent *event) { PBL_ASSERTN(queue); return (xQueueSendToBack(queue, event, mi...
(s_from_app_event_queue, event, 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...
(s_bt_lock)
; }
date_distance(a); cl_assert(distance < TEST_ANIMATION_NORMALIZED_LOW); // Execute to the start of B prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_s...
(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 1)
; // Execute to the end of B & C prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 3); // If we keep going, we sho...
(0x00, &val)
; if (val == 0x01) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the max14690"); return true; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read max14690 whomai byte 0x%x, expecting 0x%x", val, 0x01); return false; } } static bool prv_set_pin_config(void) { periph_config_acquire_lock(); // Init...
case HRMEvent_HRV: if (!(state->features & HRMFeature_HRV)) { continue; } break; case HRMEvent_Diagnostics: if (!(state->features & HRMFeature_Diagnostics)) { continue; } break; case HRMEvent_SubscriptionExpiring: continue; ...
rtc_get_time()
; RtcTicks cur_ticks = rtc_get_ticks(); HRMFeature kernel_bg_features_sent = 0; HRMSubscriberState *state = (HRMSubscriberState *)s_manager_state.subscribers; while (state) { HRMSubscriberState *expired_state = NULL; // Update the time stamp for when this subscriber last received an update if the sens...
tributes: return ancs_util_is_complete_notif_attr_response(data, length, out_error); case CommandIDGetAppAttributes: return ancs_util_is_complete_app_attr_dict(data, length, out_error); default: *out_error = false; break; } return false; } static void prv_reassembly_handle_complete_...
prv_reset_and_next()
; } // ----------------------------------------------------------------------------- // Get Notification Attributes request static void prv_add_attributes_to_request(Buffer *request_buffer) { static const struct PACKED { NotificationAttributeID positive_action:8; NotificationAttributeID negative_action:8; ...
-------------------------------------- static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (SleepFileTestEntry) { .samples = state->samples, .version = 1, .total = {-1, -1, -1}, .deep = {-1, -1, -1}, .start_at = {-1, -1...
strlen(token)
+ 1, "%d", &state->test_entry.in_sleep.min); } else if (strcmp(token, "TEST_IN_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.max); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in...
((offset.raw_value * offset.raw_value) >> FIXED_S16_3_PRECISION) / offset_radius_sq) << FIXED_S16_3_PRECISION)) }; } static GPointPrecise prv_get_rotated_precise_point(GPointPrecise center, uint16_t radius, uint32_t angle) { ...
(ctx, GPoint(p.x - x, p.y - y))
; graphics_private_set_pixel(ctx, GPoint(p.x - y, p.y - x)); } } } static void prv_plot4(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset, int8_t brightness, GColor stroke_color, GCornerMask quadrant) { /* * This will mirror given offset point over x and y coordinates o...
/* * 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...
expandable_dialog_create(NULL)
; Dialog *dialog = expandable_dialog_get_dialog(ex_dialog); dialog_set_text_buffer(dialog, missed_message, true); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_TINY); dialog_show_status_bar_layer(dialog, true); expandable_dialog_push(ex_dialog, modal_manager_get_window_stack(ModalPriorityGeneric)); } /...
(sector * SECTOR_SIZE_BYTES + addr)) { return false; } } return true; } static void prv_handle_ping_request(const void *payload, uint32_t length) { // echo it back prv_send_frame(OPCODE_PING, payload, length); } static void prv_handle_disconnect_request(const void *payload, uint32_t length) { if (...
if (prv_is_erased(request->address, request->length)) { response.complete = 1; } else { response.complete = 0; start_erase = true; }
prv_send_frame(OPCODE_FLASH_ERASE, &response, sizeof(response)); // start the erase after sending the response if (start_erase) { uint32_t end_address = request->address + request->length; s_flash_erase_in_progress = true; flash_erase_optimal_range( request->address, request->address, end_ad...
f this takes too long uint8_t status; while (((status = prv_read_status_register(sector_base_addr)) & S29VSStatusBit_DeviceReady) == 0) { delay_us(10); } return (status); } //! Issue the second part of a two-cycle command. This is not merged with the //! prv_issue_command as not all commands have...
flash_impl_get_sector_base_address(start_sector)
exti_enable(config); } initialize_button_timer(); // If someone is holding down a button, we need to start up the timer immediately ourselves as // we won't get a button down interrupt to start it. if (button_get_state_bits() != 0) { prv_enable_button_timer(); } } // Interrupt Service Routines ...
event_put(&e)
eating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_handler); } static void draw_ui_element(GContext *ctx, GRect bounds, const char *text, bool chosen, bool selected) { GFont font = fonts_get_system_font(chosen...
{ AppData *data = window_get_user_data(s_window); layer_destroy(data->canvas_layer); }
/* * 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...
{ memset(addr, 0, n); }
ALIAS("__aeabi_memclr") void __aeabi_memclr4(void *s, size_t n); ALIAS("__aeabi_memclr") void __aeabi_memclr8(void *s, size_t n); #endif
ers_processed(NULL, 0, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); // Layer A's recognizer's gesture completes immediately. All recognizers receive the touch event // because Layer A's reco...
(recognizers[0]->state, RecognizerState_Started)
; cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); // was already cancelled cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); // A child layer of the active layer becomes active when a window recognizer is triggered e.type = TouchEvent_Touchdown; s_active_layer = &layer_c;...
/* * 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...
((ListNode *)tmp)
; kernel_free(tmp); tmp = next; } if (connection->ppogatt_wa_state) { ppogatt_destroy_state(connection->ppogatt_wa_state); } kernel_free(connection); } } prv_unlock(); } bool connection_is_valid(Connection *connection) { bool rv; prv_lock(); { rv = li...
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. * See the Licen...
layer_add_child(&window->layer, &scroll_layer->layer)
; } static void push_window(struct AppState *data) { Window* window = &data->window; window_init(window, WINDOW_NAME("Text Layout Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_sta...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // This field holds the caller's name if the phone number belongs to a contact, // or the actual phone number if it does not belong to a contact const ANCSAttribute *caller_id = notif_attributes[FetchedNotifAttributeIndexTitle]; char caller_id_str[caller_id->length + 1]; pstring_pstring16_to_string(&caller...
void ancs_phone_call_handle_removed(uint32_t uid, bool ios_9) { prv_put_call_event(PhoneEventType_Hide, uid, NULL, ios_9); } bool ancs_phone_call_should_ignore_missed_calls(void) { return regular_timer_is_scheduled(&s_missed_call_timer_id); } static void prv_handle_missed_call_timer_timeout(void *not_used) { if...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
do_not_disturb_init()
sed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under th...
(&image->layer)
; } void rot_bitmap_set_compositing_mode(RotBitmapLayer *image, GCompOp mode) { if (mode == image->compositing_mode) { return; } image->compositing_mode = mode; layer_mark_dirty(&image->layer); }
{ 1616, 616, -216}, { 1552, 928, -96}, { 1080, 1544, -240}, { 760, 1144, -200}, { 952, 1136, -144}, { 920, 896, -152}, { 1312, 720, -104}, { 1920, 760, -32}, { -1992, 728, -32}, { 2000, 616, -24}, { 2016, 328, 56}, { 1904, 328, 32}, { 1760, 488, -152}, { 1496, 376, -2...
{ 1696, 440, -48}, { 1456, 352, -208}, { 1304, -56, -120}, { 728, -552, 8}, { 792, -304, -472}, { 1200, -344, -232}, { 1584, 72, -232}, { 1632, 160, -120}, { 1888, 280, -128}, { 1944, 440, -248}, { 1872, 568, -192}, { 1768, 696, -96}, { 1528, 832, 16}, { 1504, 592...
{ 1144, 1312, -328}, { 864, 1008, -256}, { 1072, 1048, -280}, { 936, 728, -336}, { 1096, 672, -216}, { 1672, 688, -56}, { 1848, 616, -8}, { 1816, 544, -112}, { 1784, 440, -56}, { 1808, 432, 24}, { 1744, 464, -56}, { 1448, 368, -208}, { 1336, 128, -240}, { 928, -3...
.minute = 14, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); bool custom_schedule1[7] = {true, false, true, false, false, true, true}; alarm_set_custom(id, custom_schedule1); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_CUSTOM, cust...
alarm_set_enabled(id1, false)
; prv_assert_alarm_config(id1, 3, 14, true, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 3); cl_assert_equal_i(s_num_timeline_removes, 3); alarm_set_enabled(id1, true); prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equ...
/* * 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_applib_get_tick_timer_service_state()
; } else { WTF; } } static void do_handle(PebbleEvent *e, void *context) { TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown); PBL_ASSERTN(state->handler != NULL); TimeUnits units_changed = 0; struct tm currtime; sys_localtime_r(&e->clock_tick.tick_time, &currtime); if (!state->fir...
e->samples_per_update - state->num_samples; ask_for = MAX(ask_for, state->subsample_numerator); ask_for = ask_for / state->subsample_numerator * state->subsample_numerator; PBL_ASSERTN(state->num_samples + ask_for <= state->raw_buffer_size); num_samples = accel_consume_data(state->raw_b...
(uint32_t, sys_accel_manager_get_buffer_size, AccelSessionRef session, uint32_t samples_per_update)
{ return samples_per_update + 1; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(int, sys_accel_manager_set_sample_buffer, AccelSessionRef session, AccelRawData *buffer, uint32_t buffer_size, uint32_t samples_per_update) { int result ...
PER_PAGE) ? metric_margin_top : (context->index % METRICS_PER_PAGE) ? metric_margin_h_round_inner : metric_margin_h_round_page); metric_node->offset.y += metric_margin_h; metric_node->margin.h += metric_margin_h; } retur...
((GRect) { .size = kino_reel_get_size(icon_reel) })
; *config->icon_layer = icon_layer; kino_layer_set_alignment(icon_layer, config->align); kino_layer_set_reel(icon_layer, icon_reel, true /* take_ownership */); layer_add_child((void *)&layout->layer, &icon_layer->layer); GTextNodeCustom *custom = layout_node_create_kino_layer_wrapper(icon_layer); prv_set_te...
/* * 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, device_name)
; kernel_free(ctx); if (bonding_id == BT_BONDING_ID_INVALID) { return; } // Can't access flash when bt_lock() is held... if (!bt_persistent_storage_update_ble_device_name(bonding_id, device_name)) { return; } PebbleEvent event = { .type = PEBBLE_BLE_DEVICE_NAME_UPDATED_EVENT, }; event_p...
------------------------------------------------------------ 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 ...
GSize(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...
" #include "process_state/app_state/app_state.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <string.h> // Initial pixel scroll amount, paging_height (LAYOUT_HEIGHT) for circular display #define INITIAL_SCROLL_PX PBL_IF_RECT_ELSE(LAYOUT_BANNER_HEIGHT_RECT, LAYOUT_HEIGHT) /...
swap_layer->callbacks.layout_will_appear_handler(swap_layer, layout, swap_layer->context)
}, // 46 seconds { 824, 152, 120}, { 880, 152, 80}, { 1040, 120, 72}, { 1176, 40, 88}, { 1456, 112, 40}, { 1224, 224, -304}, { 1080, 168, -400}, { 1344, 288, -408}, { 1424, 312, -240}, { 1144, 272, -160}, { 904, 264, -128}, { 800, 264, -64}, { 784, 280, -104}, ...
{ 1104, 216, 0}, { 1080, 200, 0}, { 1064, 192, 0}, { 1080, 168, -16}, { 1064, 160, -56}, { 1024, 136, -72}, { 1032, 104, -64}, { 1032, 96, -64}, // 52 seconds { 1032, 152, -80}, { 1032, 152, -72}, { 1024, 176, -72}, { 912, 448, 232}, { 1136, -480, -744}, { 976...
{ 1016, 296, -152}, { 880, 304, -80}, { 832, 264, -64}, { 816, 288, -32}, { 864, 368, -64}, { 912, 384, -56}, { 1024, 416, -56}, { 1264, 480, -96}, { 1352, 488, -88}, { 1624, 472, -40}, { 1376, 568, -160}, { 1128, 456, -128}, { 1312, 392, -128}, { 1384, 312, -40}...
/* * 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 (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. property_animation_legacy2_update_int16((PropertyAnimationLegacy2 *)property_animation_h, ...
PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } int16_t result = interpolate_int16(distance_normalized, property_animation->values.from.int16, p...
p comes out. serial_console_set_state(SERIAL_CONSOLE_STATE_LOGGING); uint8_t buffer[128]; while (length) { uint32_t chunk_size = MIN(length, 128); flash_read_bytes(buffer, address, chunk_size); PBL_LOG(LOG_LEVEL_ALWAYS, "Data at address 0x%"PRIx32, address); hexdump_log(LOG_LEVEL_ALWAYS, buffer...
{ prompt_send_response_fmt(buffer, sizeof(buffer), ">FAIL: TEST CASE %"PRId32", Status: %"PRId32, test_case_num, status); }
} void command_flash_validate(void) { // just test one sector, which is probably less than the size of the region const uint32_t TEST_ADDR = FLASH_REGION_FIRMWARE_SCRATCH_BEGIN; const uint32_t TEST_LENGTH = SECTOR_SIZE_BYTES; PBL_ASSERTN((TEST_ADDR & SECTOR_ADDR_MASK) == TEST_ADDR); PBL_ASSERTN((TEST_ADDR +...
heckerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_odd_rows_no_clip")))
; // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.des...
ion_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)); s_dnd_active = true; alerts_set_dnd_mask(AlertMaskAllOff); alerts_set_mask(AlertMaskAllOff); cl_assert(!alerts_should_notify_for_type(AlertPhoneCall...
(alerts_should_enable_backlight_for_type(AlertOther))
; }
cepting_outbound(), true); } void test_app_message__nack_then_outbox_sent(void) { // Sending ack on timeout, but reject the send prv_set_remote_receive_handler(prv_nack_sent_callback); prv_send_test_data(); prv_process_sent_data(); cl_assert_equal_b(app_message_is_accepting_outbound(), false); prv_call_ou...
(app_message_outbox_begin(&iter), APP_MSG_BUSY)
t_cell_height_callback, .get_num_rows = prv_get_num_rows_callback, .draw_row = prv_draw_row_callback, .select_click = prv_select_callback }); menu_layer_set_click_config_onto_window(&option_menu->menu_layer, window); if (option_menu->choice != OPTION_MENU_CHOICE_NONE) { menu_layer_set_select...
(chosen_image, RESOURCE_ID_CHECKED_RADIO_BUTTON)
; GBitmap *not_chosen_image = &option_menu->not_chosen_image; gbitmap_init_with_resource(not_chosen_image, RESOURCE_ID_UNCHECKED_RADIO_BUTTON); window_init(&option_menu->window, WINDOW_NAME("OptionMenu")); window_set_user_data(&option_menu->window, option_menu); window_set_window_handlers(&option_menu->windo...
uint8_t bufcmp[PFS_SECTOR_SIZE * 2]; memset(&bufcmp[0], i, sizeof(bufcmp)); int fd = pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); cl_assert_equal_i(pfs_read(fd, &buf[0], sizeof(buf)), sizeof(buf)); cl_assert(memcmp(buf, bufcmp, sizeof(buf)) == 0); cl_assert...
sprintf(filename, "test%d", i + start_page_offset)
; int fd = pfs_open(filename, OP_FLAG_READ, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); } } void test_pfs__remove_files(void) { pfs_format(true); pfs_init(false); // Create some files int fd; fd = pfs_open("a_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); ...
ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3312 - 3328 */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3328 - 3344 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3344 - 3360 */ 0xff, 0xff...
(RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug")
; cl_assert(s_watch_res_callback_called_count == 1); // Turn off watch resource_unwatch(cb_handle); // Callback should get invoked if resource was written to s_watch_res_callback_called_count = 0; load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug"); cl_assert(s_watch_res_callba...
y = { .integer = bounds->size.h / 2 - 1, .fraction = 3 } }; } return GPointPreciseFromGPoint(imprecise_center_point); } static void prv_draw_clock_face(GContext *ctx, ClockFace *face) { MultiWatchData *data = app_state_get_user_data(); const GRect *bounds = &window_get_root_layer(&data->window)->bounds; ...
watch_model_cleanup()
; } void tictoc_main(void) { prv_init(); app_event_loop(); prv_deinit(); }
(!list || !context) { return; } ScaleSegmentedData *data = context; GDelayCreatorContext delay_ctx = { .list = list, .size = size, }; if (!data->lookup.creator) { return; } GPointIndexLookup *index_lookup = data->lookup.creator(&delay_ctx, data->lookup.userdata); GRect intermediate; ...
kino_reel_transform_get_from_reel(reel)
; GDrawCommandList *list = kino_reel_get_gdraw_command_list(from_reel); if (!list) { return false; } DistanceLookupData *lookup_data = applib_malloc(sizeof(DistanceLookupData)); if (!lookup_data) { return false; } *lookup_data = (DistanceLookupData) { .target = target }; const bool take_ownershi...
andle_hrm_data(PebbleEvent *e, void *context) { AppData *app_data = app_state_get_user_data(); if (e->type == PEBBLE_HRM_EVENT) { PebbleHRMEvent *hrm = &e->hrm; // Save HRMEventBPM data and send when we get the current into. static uint8_t bpm = 0; static uint8_t bpm_quality = 0; static uint16...
text_layer_set_text(&app_data->bpm_text_layer, "Paused")
; text_layer_set_text(&app_data->quality_text_layer, "Paused by mobile"); prv_disable_hrm(); } else { app_data->bpm_string[0] = '\0'; text_layer_set_text(&app_data->bpm_text_layer, app_data->bpm_string); text_layer_set_text(&app_data->quality_text_layer, "Loading..."); prv_enable_hrm(); } } ...
imation_by_parent_child_idx(state, animation, child_idx); if (!child) { // No more children break; } if (now != earliest_start_time) { // We need to adjust the delays of each child since one or more were already scheduled uint32_t child_start; if (child->abs_st...
{ // animation->duration_ms/2 added in for round to nearest time_normalized_raw = (ANIMATION_NORMALIZED_MAX * rel_ms_running + animation->duration_ms/2) / animation->duration_ms; time_normalized_raw = MIN(time_normalized_raw, ANIMATION_NORMALIZED_MAX); }
return time_normalized_raw; } AnimationProgress animation_private_get_animation_progress(const AnimationPrivate *animation) { // FIXME PBL-25497: Make this function less fragile // Calling prv_get_ms_since_system_start() here means this function will have different return // values if it's called multiple tim...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_m(&s_cache_buffer[2], &ZERO_ITEM, sizeof(TestCacheItem))
; circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[2], &s_test_item[1], sizeof(TestCacheItem)); circular_cache_p...
cl_assert_equal_i(stored_session->start_utc, session.start_utc); cl_assert_equal_i(stored_session->length_min, 20); cl_assert_equal_i(stored_session->step_data.steps, 3800); cl_assert_equal_i(stored_session->step_data.active_kcalories, 200 + calculated_active_kcalories); cl_assert_equal_i(stored_session->step_d...
workout_service_start_workout(ActivitySessionType_Run)
); prv_put_bpm_event(100, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); // Time forward X seconds prv_inc_time(30); cl_assert(workout_service_get_cu...
ent pin"); } kernel_free(parent_id); } static void prv_perform_health_response_action(const TimelineItem *item, const TimelineItemAction *action) { const uint8_t insight_type = attribute_get_uint8(&item->attr_list, AttributeIdHealthInsightType, ...
{ *parent_id = item->header.parent_id; launcher_task_add_callback(prv_get_pin_and_push_pin_window, parent_id); PBL_LOG(LOG_LEVEL_INFO, "Opening parent pin %s", uuid_buffer); }
break; } case TimelineItemActionTypeAncsDial: { const char *caller_id = attribute_get_string(&item->attr_list, AttributeIdTitle, "Unknown"); prv_put_outgoing_call_event(item->header.ancs_uid, caller_id); notifications_handle_notific...
/* * 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_write_cmd_no_addr(dev, dev->state->part->instructions.write_enable)
; // wait for writing to be enabled qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status, dev->state->part->status_bit_masks.write_enable, true /* set */, QSPI_NO_TIMEOUT); } static bool prv_check_whoami(QSPIFlash *dev) { // The WHOAMI is 3 bytes const uint32_t whoami_length = 3;...
cl_assert_equal_i(windows[0]->on_screen, true); window_stack_push(stack, windows[1], true); cl_assert_equal_i(window_stack_count(stack), 2); cl_assert_equal_i(windows[0]->on_screen, false); cl_assert_equal_i(windows[1]->on_screen, true); window_stack_push(stack, windows[2], true); cl_assert_equal_i(wind...
{ break; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ switch (pebble_task_get_current()) { case PebbleTask_App: return (tinymt32_t*)app_state_get_rand_ptr(); case PebbleTask_Worker: return (tinymt32_t*)worker_state_get_rand_ptr(); default: return &s_kernel_rand; } }
ft and right side of the circle if (draw_top) { prv_draw_scanline_collision_points(ctx, center.y.integer - i - special_line_offset_top, left, inner_left, top_starting_edge, top_ending_edge, ignore_close_angles); ...
prv_fill_oval_precise(ctx, center_precise, outer_x_precise, outer_y_precise, inner_x_precise, inner_y_precise, angle_start, angle_end)
; } void prv_fill_oval_quadrant_precise(GContext *ctx, GPointPrecise point, Fixed_S16_3 outer_radius_x, Fixed_S16_3 outer_radius_y, Fixed_S16_3 inner_radius_x, Fixed_S16_3 inner_radius_y, GCornerMask quadrant) {...
2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS...
(false /* disconnected */)
; check_disconnected(); //! Get disconnected event prv_send_connection_event(false); check_waiting_to_send_second_disconnect(); // No event put cl_assert_equal_i(s_event_count, 0); } void test_debounced_connection_service__disconnected_wait_disconnected(void) { //! Currently disconnected init(false...
analytics_logging.h" #include "services/common/analytics/analytics_external.h" // Stopwatches typedef struct { ListNode node; AnalyticsMetric metric; RtcTicks starting_ticks; uint32_t count_per_sec; AnalyticsClient client; } AnalyticsStopwatchNode; static ListNode *s_stopwatch_list = NULL; static bool prv_i...
analytics_stopwatch_start_at_rate(metric, MS_PER_SECOND, client)
; } void analytics_stopwatch_start_at_rate(AnalyticsMetric metric, uint32_t count_per_sec, AnalyticsClient client) { analytics_storage_take_lock(); // Stopwatch metrics must be UINT32! PBL_ASSERTN(analytics_metric_element_type(metric) == ANALYTICS_METRIC_ELEMENT_TYPE_UINT32); if (prv_find_stopwatch(metric)) ...
< ARRAY_LENGTH(s_operating_states); i++) { if (s_operating_states[i].enabled) { odr_max = MAX(odr_max, s_operating_states[i].odr); } } uint32_t sample_interval = 0; switch (odr_max) { case BMA255ODR_1HZ: sample_interval = BMA255SampleInterval_1HZ; break; case BMA255ODR_10HZ: ...
if (BMA255SampleInterval_125HZ <= interval_us) { sample_interval = BMA255SampleInterval_125HZ; } else if (BMA255SampleInterval_166HZ <= interval_us) { sample_interval = BMA255SampleInterval_166HZ; } else if (BMA255SampleInterval_250HZ <= interval_us) { sample_interval = BMA255SampleInterval_250HZ; } e...
return sample_interval; } static void prv_enable_operating_mode(AccelOperatingMode mode, BMA255SampleInterval sample_interval) { s_operating_states[mode].enabled = true; s_operating_states[mode].odr = prv_get_odr(sample_interval); prv_configure_operating_mode(); } static...
return buffer - buf_start; } bool attribute_deserialize_list(char **buffer, char *const buf_end, const uint8_t **cursor, const uint8_t *payload_end, AttributeList attr_list) { for (int i = 0; i < attr_list.num_attributes; i++) { if (!prv_deserialize_attribute(buffer, buf_end, cursor, payload_end, ...
prv_attribute_type(id)
!= AttributeTypeUint32) { PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint32 for non-uint32_t attribute"); } prv_add_attribute(list, id)->uint32 = uint32; } void attribute_list_add_resource_id(AttributeList *list, AttributeId id, uint32_t resource_id) { if (prv...
/* * 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_draw_line(ctx, GPoint(0, segment_height * i), GPoint(SCREEN_WIDTH, segment_height * i))
; } #endif gpath_rotate_to(s_current_path, s_path_angle * TRIG_MAX_ANGLE / 360); if (s_outline_mode) { graphics_context_set_stroke_color(ctx, GColorBlack); gpath_draw_outline(ctx, s_current_path); } else { graphics_context_set_fill_color(ctx, GColorBlack); gpath_draw_filled(ctx, s_current_path...
{ 1136, 224, -496}, { 1064, 368, -496}, { 1144, 368, -424}, { 1272, 416, -384}, { 1392, 488, -336}, { 1272, 480, -280}, { 1248, 536, -200}, { 1384, 696, 192}, // 5 seconds { 1024, 880, 208}, { 880, 440, 264}, { 968, 736, 352}, { 880, 672, 296}, { 1008, 536, 248}, ...
{ 1328, 128, -120}, { 976, 200, -48}, { 880, 200, 64}, { 1008, 216, 8}, { 1080, 248, -16}, { 880, 312, 0}, { 864, 344, 88}, { 1312, 496, 240}, { 840, 1008, 232}, { 1064, 288, -8}, { 1248, 272, 16}, { 1320, 504, 24}, { 1408, 496, 128}, { 1624, 352, 136}, { 1400...
{ 1248, 152, 160}, { 1216, 16, 128}, { 1184, -16, 64}, { 1056, 56, 24}, { 952, 104, 0}, { 968, 96, 24}, { 1224, 112, 56}, { 1168, 96, 40}, { 1120, 56, 40}, { 1264, 24, -216}, { 1296, -64, -152}, { 1112, -72, -96}, { 992, -72, -136}, { 936, 8, -248}, { 856, 10...
/* * 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...
button_get_state_bits()
== 0; }
color_animation = property_animation_get_animation( property_animation_create(&s_color_slide_animation_impl, NULL, &width, &zero)); s_phone_ui_data->bg_color.boundary = width; } s_phone_ui_data->bg_color_animation = color_animation; animation_set_duration(color_animation, COLOUR_ANIMATION_FRAMES *...
(ctx, &layer->bounds)
EXIT_CRITICAL(); } static void prv_watchdog_init(void) { s_spi_transport.watchdog_timer_active = false; // Enable the timer clock periph_config_enable(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, BOARD_BT_WATCHDOG_TIMER.timer.config_clock); // Setup timer 3 to generate Bluetooth Host Tran...
( CRC32_INIT, s_spi_transport.tx_read_ptr, s_spi_transport.bytes_sendable_count)
; dialog_spi_send_and_receive_dma(s_spi_transport.tx_footer, NULL, sizeof(*s_spi_transport.tx_footer), prv_handle_sending_footer_complete_isr); } static void prv_handle_int_waiting_for_sending(void) { s_spi_transport.state = SPITransportState_Sen...
if (args.num_args != cmd->num_params) { char buffer[128]; prompt_send_response_fmt(buffer, sizeof(buffer), "Incorrect number of arguments: Wanted %u Got %u", cmd->num_params, args.num_args); goto done; } if (cmd->num_params == 4) { ((Com...
if (UNLIKELY(c == 0x7f)) { // Backspace if (s_dbgserial_prompt_context.write_index != 0) { s_dbgserial_prompt_context.write_index--; dbgserial_putchar(0x8); // move cursor back one character dbgserial_putchar(0x20); // replace that character with a space, advancing the cursor dbgserial_putch...
/* * 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...
{ HealthData health_data = { .step_data = {600, 900, 700, 1200, 1400, 1300, 1000}, .monthly_step_average = 1000, }; HealthDetailCard *card = (HealthDetailCard *)prv_create_card_and_render(&health_data); #if PBL_ROUND menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 3), MenuRowAlignCenter,...
; cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_saturday; cron_service_wakeup(); 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_...
(s_num_alarm_events_put, 3)
; cl_assert_equal_i(s_num_timeline_adds, 14); cl_assert_equal_i(s_num_timeline_removes, 9); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again, but not until Monday s_current_hour = 11; s_current_minute = 30; cron_servic...
e); pulse_push_send(contents, payload_length); } static bool prv_isr_buffer_read_and_consume(void *buffer, size_t read_length) { portENTER_CRITICAL(); const bool result = circular_buffer_copy(&s_isr_log_buffer, buffer, read_length); if (result) { circular_buffer_consume(&s_isr_log_buffer, read_length); ...
prv_send_pulse_packet(log_level, src_filename, src_line_number, message)
gbitmap_destroy(src_bitmap)
; } void test_bitblt_palette_1bit__get_1bit_graphics_grayscale_pattern(void) { cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorWhite, 0), 0xFFFFFFFF); cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorWhite, 1), 0xFFFFFFFF); cl_assert_equal_i(graphics_private_get_1bit_graysc...
(vector, sizeof(vector), sizeof(expected))
; assert_out_equal(expected, sizeof(expected)); } void test_cobs_encode__max_block_2(void) { // vector[] = { 0x01, 0x02, ..., 0xfe, 0xff }; uint8_t vector[255]; for (size_t i = 0; i < sizeof(vector); ++i) { vector[i] = i + 1; } // expected[] = { 0xff, 0x01, 0x02, ..., 0xfe, 0x02, 0xff }; uint8_t expec...
ls_list_find_by_session_id(uint8_t session_id) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *iter = s_logging_sessions; while (iter != NULL) { if (iter->comm.session_id > session_id) { break; } if (iter->comm.session_id == session_id) { mutex_unlock_recursive(s_list_mutex); ...
prv_get_num_sessions()
_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Complete A the first time prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries...
(&s_setup_handler_calls, a)
); // Only animate if the window was previously at the top of the stack and there's a // window we can transition to. if (window_from && window_to) { prv_transition_to(window_from, window_to, transition); } else { // We don't fire a transition in this case, but to ensure that all window-callbacks /...
(window_stack->removed_list_head, &next_item->list_node)
; window_set_on_screen(next_item->window, false /* not new */, true /* call handlers */); } while (true); window_stack_pop(window_stack, animated); } bool window_stack_remove(Window *window, bool animated) { if (window == NULL) { return false; } WindowStackItem *item = prv_find_window_stack_item_f...
/* * 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...
(&image->layer, &r)
; r.origin = GPoint(0, 0); layer_set_bounds(&image->layer, &r); image->dest_ic = GPoint(new_dist / 2, new_dist / 2); layer_mark_dirty(&image->layer); } void rot_bitmap_set_compositing_mode(RotBitmapLayer *image, GCompOp mode) { if (mode == image->compositing_mode) { return; } image->compositing_mo...
les >= state->samples_per_update) { // Notify the subscriber that data is available state->event_posted = prv_call_data_callback(state); ACCEL_LOG_DEBUG("full set of %d samples for session %p", state->num_samples, state); if (!state->event_posted) { PBL_LOG(LOG_LEVEL_INFO, "Failed to p...
(&data, accel_data)
; prv_update_last_accel_data(&data); } mutex_unlock_recursive(s_accel_manager_mutex); return result; } DEFINE_SYSCALL(AccelManagerState*, sys_accel_manager_data_subscribe, AccelSamplingRate rate, AccelDataReadyCallback data_cb, void* context, PebbleTask handler_task) { Accel...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(intensity)
); } VibeIntensity vibe_intensity_get(void) { return alerts_preferences_get_vibe_intensity(); } const char *vibe_intensity_get_string_for_intensity(VibeIntensity intensity) { switch (intensity) { case VibeIntensityLow: { /// Standard vibration pattern option that has a low intensity return i18n_no...
= activity_private_compute_resting_calories(elapsed_minutes); new_history.values[i] = ROUND(cur_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL); } else { new_history.values[i] = ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL); } } ...
syscall_assert_userspace_buffer(history, history_len * sizeof(*history))
the AS3701B datasheet for more information. typedef enum { PmicResetReason_PowerUpFromScratch = 0x00, //!< Battery or charger insertion from scratch PmicResetReason_ResVoltFall = 0x01, //!< Battery voltage drop below 2.75V PmicResetReason_ForcedReset = 0x02, //!< sw force_reset PmicResetReason_OnPulledHigh = ...
PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b")
; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id); } return found; } bool pmic_init(void) { prv_init_gpio(); if (!prv_is_alive()) { return false; } prv_start_120hz_clock(); return true; } bool pmic_is_usb_connected(void) { uint8_t status; ...
Request); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); } void test_rocky_api_app_message__awaiting_reset_complete_rem_init__malformed_reset_complete(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); // Receive malformed ResetComplete: uint8_t malformed_payload[sizeof(PostMessageResetCompletePayload...
ASSERT_JS_GLOBAL_EQUALS_B("isCalled", true)
; // TODO: assert: // - flushed recv chunk reassembly buffer } void test_rocky_api_app_message__session_open__rcv_reset_complete(void) { prv_init_and_goto_session_open(); EXECUTE_SCRIPT("var isCalled = false;" "_rocky.on('postmessagedisconnected', function() { isCalled = true; });"); ASSE...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(s_get_bytes_impls)
; i++) { if (s_get_bytes_impls[i].type == prv_get_storage_type_for_object(object_type)) { storage->impl = &s_get_bytes_impls[i]; if (storage->impl->setup) { return storage->impl->setup(storage, object_type, info); } } } return false; } GetBytesInfoErrorCode gb_storage_get_size(G...