prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
color name' or '#hex') or Number"; static const char COLOR_ERROR_MSG[] = "Expecting String ('color name' or '#hex') or Number"; typedef struct { const char *expected_type_name; int arg_offset; } RockyArgTypeCheckError; typedef struct { const char *error_msg; int arg_offset; } RockyArgValueCheckError; typedef...
if (should_release) { jerry_release_value(str_val); }
} static void prv_malloc_and_assign_string_applier(const jerry_value_t str, const RockyArgBinding *binding) { *((char **)binding->ptr) = rocky_string_alloc_and_copy(str); } static bool prv_malloc_and_assign_string(const RockyArgBinding *binding, const jerry_value_t ...
TestPLParsedMsg input = { .type = ProtobufLogType_Measurements, .msrmt = { .time_utc = rtc_get_time(), .utc_to_local = time_util_utc_to_local_offset(), .num_types = ARRAY_LENGTH(types), .types = types, .num_samples = ARRAY_LENGTH(offset_sec), .offset_sec = of...
for (unsigned i = 0; i < input.msrmt.num_samples; i++) { rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]); success = protobuf_log_session_add_measurements(session_ref, rtc_get_time(), input.msrmt.num_types, ...
// Flush it out now, this should end up in our transport method being called TestPLParsedMsg *msg = prv_flush_get_record(&input, false /* use_data_logging */, session_ref); prv_assert_msg_equal(&input, msg); // ------------------ // Send another set of measurements uint32_t offset_sec_b[] = {2, 4, 6}; ...
ype event_type; } InstallData; void prv_alert_data_source_changed(AppMenuDataSource *data_source) { if (data_source->callbacks.changed) { data_source->callbacks.changed(data_source->callback_context); } } static void prv_do_app_added(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_...
{ prv_unload_node(source, iter); }
app_num, uint32_t resource_id) { return 0; } static bool s_skip_mem_leak_check; static void prv_init(void) { rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); } static void prv_deinit(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } void test_js__initialize(void) { fake_pbl_malloc_cl...
cl_assert_equal_i(2, s_graphics_fill_rect.call_count)
; cl_assert_equal_i(0, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_i(0, s_graphics_draw_line.call_count); cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count); cl_assert_equal_i(0, s_graphics_context_set_stroke_color.call_count); cl_assert_equal_i(0, s_graphics_co...
BOARD_CONFIG.mic_config.spi_clock_ctrl); periph_config_release_lock(); gpio_use(BOARD_CONFIG.mic_config.i2s_ck.gpio); gpio_use(BOARD_CONFIG.mic_config.i2s_sd.gpio); // Configure pins as SPI/I2S pins GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_I...
SPI_I2S_DMACmd(BOARD_CONFIG.mic_config.spi, SPI_I2S_DMAReq_Rx, ENABLE)
; // Enable I2S I2S_Cmd(BOARD_CONFIG.mic_config.spi, ENABLE); // DMA config - use single buffer circular mode. Pointer to buffer is a 2-D array for ease of // access void *periph_addr = (void *)&BOARD_CONFIG.mic_config.spi->DR; stop_mode_disable(InhibitorMic); dma_request_start_circular(MIC_I2S_RX_DMA, ...
/* * 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 EM_ASM_INT({ var child_process = require('child_process'); try { var args = []; for (var i = 0;; i++) { var argStrPtr = getValue($0 + i*4, '*'); if (argStrPtr === 0) { break; } var arg = Pointer_stringify(argStrPtr); args.push(arg); ...
value, &value_length, &has_more); if (handler) { handler(object_ref, value, value_length, 0 /* value_offset (future proofing) */, gatt_error); } value_length = next_value_length; } applib_free(value); }...
event_service_client_unsubscribe(&ble_app_state->gatt_client_service_info)
; } } } return BTErrnoOK; } BTErrno ble_client_set_service_filter(const Uuid service_uuids[], uint8_t num_uuids) { // TODO return 0; } BTErrno ble_client_set_service_change_handler(BLEClientServiceChangeHandler handler) { const off_t offset = offsetof(BLEAppSt...
th); state->dp = opendir(state->res_path); if (state->dp == NULL) { printf("\nCould not open directory %s", state->res_path); return false; } state->type = samples_type; return true; } // --------------------------------------------------------------------------------------- // Advance to the next...
{ return strcmp(entry_a->name, entry_b->name); }
} // -------------------------------------------------------------------------------------- // Callback provided to the qsort() routine for sorting sleep tests by name int prv_qsort_sleep_test_entry_cb(const void *a, const void *b) { SleepFileTestEntry *entry_a = (SleepFileTestEntry *)a; SleepFileTestEntry *entr...
xtOverflowModeTrailingEllipsis; const GTextAlignment text_alignment = GTextAlignmentCenter; const GSize text_size = graphics_text_layout_get_max_used_size(ctx, item->label, font, *content_box, overflow_mode, ...
(&ctx->draw_state.clip_box, &ctx->dest_bitmap.bounds)
; #endif graphics_context_set_text_color(ctx, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack)); graphics_context_set_fill_color(ctx, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); } PBL_IF_RECT_ELSE(prv_cell_item_content_draw_rect, prv_cell_item_content_draw_round)(ctx, cell_layer, aml, item,...
uts(PmicGpio set_mask, PmicGpio clear_mask) { PBL_ASSERTN((set_mask & clear_mask) == 0); uint8_t new_output_state = s_pmic_gpio_output_state; new_output_state |= set_mask; new_output_state &= ~clear_mask; if (prv_write_register(PmicRegisters_GPIO_SIG_OUT, new_output_state)) { s_pmic_gpio_output_state = ne...
pmic_set_charger_state(true)
; // Enable AutoResume: Resumes charging on voltage drop after EOC prv_set_register_bit(PmicRegisters_CHARGE_CNTL, 6, true); } static void prv_configure_battery_measure(void) { // Set PMIC GPIO5 (the battery measure enable pin) as an open-drain output // with no pull and inverted output. Setting the output to...
dd another notification. Compression should take place without freeing up a 4k block e.header.id = uuids[i]; e.header.timestamp = timestamp + i; notification_storage_store(&e); cl_assert(notification_storage_get(&uuids[i], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Ensure that compr...
{ Uuid i1; uuid_generate(&i1); TimelineItem e1 = { .header = { .id = i1, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda5, }, .attr_list = { .num_attributes = ARRAY_LENGTH(attributes), ....
cl_assert_equal_m(&e1.header, &h, sizeof(CommonTimelineItemHeader)); test.action_group.num_actions = 2; cl_assert_equal_b(notification_storage_find_ancs_notification_by_timestamp(&test, &h), false); test = e2; test.header.id = UUID_INVALID; cl_assert(notification_storage_find_ancs_not...
(ANALYTICS_APP_METRIC_QUICK_LAUNCH_COUNT, AnalyticsClient_App)
; } else if (launch_reason == APP_LAUNCH_USER) { analytics_inc(ANALYTICS_DEVICE_METRIC_APP_USER_LAUNCH_COUNT, AnalyticsClient_System); analytics_inc(ANALYTICS_APP_METRIC_USER_LAUNCH_COUNT, AnalyticsClient_App); } } // ----------------------------------------------------------------------------------------...
e_gatt_client_op_set_write_return_value(BTErrnoNotEnoughResources); // Receive data (that needs to be ack'd): uint8_t sn = 0; prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn); fake_gatt_client_op_assert_no_write(); // Receive Reset Request: prv_receive_reset_request(s_ch...
prv_assert_sent_ack(s_characteristics[0][PPoGATTCharacteristicData], sn)
; } } void test_ppogatt__close(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *client = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); cl_assert(client); ppogatt_close(client); cl_assert_equal_p(NULL, ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid)); } void test_ppogatt...
k_handler); if (music_get_playback_state() == MusicPlayStatePaused) { window_single_click_subscribe(BUTTON_ID_SELECT, prv_play_pause_click_handler); } else { window_single_click_subscribe(BUTTON_ID_SELECT, prv_ellipsis_click_handler); } window_long_click_subscribe(BUTTON_ID_UP, 0, prv_volume_long_click_...
{ return; }
00) #define I2C_TIMEOUT_ATTEMPTS_MAX (2 * 1000 * 1000) // MFI NACKs while busy. We delay ~1ms between retries so this is approximately a 1000ms timeout. // The longest operation of the MFi chip is "start signature generation", which seems to take // 223-224 NACKs, but sometimes for unknown reasons it can take much lon...
prv_bus_rail_power_down(bus)
ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 2), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoi...
{ GContext ctx; test_graphics_context_init(&ctx, fb); // Test odd and even rows draw appropriately setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics...
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_rows_no_clip"))); // Odd rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoi...
STEM_T_MARK); gbitmap_init_with_resource( &cd->aus_rcm_mark, RESOURCE_ID_SYSTEM_AUS_RCM_MARK); gbitmap_init_with_resource( &cd->nom_nyce_mark, RESOURCE_ID_SYSTEM_NOM_NYCE_MARK); // Construct the certification menu const RegulatoryFlags *flags = prv_get_regulatory_flags(); if (flags->has_usa_fcc) ...
app_free(data->certification_data.menu_items)
; prv_deinit_status_bar(&data->status_layer); } static void prv_certification_window_push(SettingsSystemData *data) { window_init(&data->window, WINDOW_NAME("System Certification")); window_set_user_data(&data->window, data); window_set_window_handlers(&data->window, &(WindowHandlers) { .load = prv_certif...
prv_close_file_and_unlock_mutex()
; return rv; } ///////////////////////// // Testing code ///////////////////////// #if UNITTEST void app_glance_db_deinit(void) { app_glance_db_flush(); mutex_destroy(s_app_glance_db.mutex); } status_t app_glance_db_insert_stale(const uint8_t *key, int key_len, const uint8_t *val, ...
TimelineResourceTestAppId_AppWithInvalidSDKVersion, TimelineResourceTestAppId_ValidApp, TimelineResourceTestAppIdInvalid, TimelineResourceTestAppIdCount = TimelineResourceTestAppIdInvalid - 1 } TimelineResourceTestAppId; static const TimelineResourceTestAppData s_test_apps[TimelineResourceTestAppIdCount] = { ...
uuid_equal(&entry->uuid, &(Uuid)UUID_SYSTEM)
) { return SYSTEM_APP; } else { return entry->install_id; } } // Setup ///////////////////////// void test_timeline_resources__initialize(void) { s_is_app_published_resource_invalid = false; } // Tests ///////////////////////// void test_timeline_resources__get_id_system(void) { AppResourceInfo res_...
types.h> #define BREAKPOINT __asm("bkpt") #define ACCEL_BATCH_SIZE 10 #define PERSIST_WRITE_PERIOD_MS 1000 // ------------------------------------------------------------------------------------------------- static void prv_assert(bool condition, const char* msg) { if (!condition) { APP_LOG(APP_LOG_LEVE...
battery_state_service_subscribe(battery_state_handler)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_equal_i(a.attributes[i].id, b.attributes[i].id); switch (a.attributes[i].id) { case AttributeIdTitle: case AttributeIdSubtitle: case AttributeIdBody: cl_assert_equal_s(a.attributes[i].cstring, b.attributes[i].cstring); break; case AttributeIdAncsAction: ...
} static void compare_notifications(TimelineItem *a, TimelineItem *b) { cl_assert(uuid_equal(&a->header.id, &b->header.id)); cl_assert_equal_i(a->header.ancs_uid, b->header.ancs_uid); cl_assert_equal_i(a->header.status, b->header.status); cl_assert_equal_i(a->header.timestamp, b->header.timestamp); cl_asser...
------------------------------------------------------------------- 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)
(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data))
; #if SCREEN_COLOR_DEPTH_BITS == 8 char print_buf[20]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y); cl_check_(gcolor_equal(get_bitmap_color(&s_bmp, x, y), s_palette[x]), print_buf); cl_check_(gcolor...
ivity_sessions, &exp_session); } // -------------------------------------------------------------------------------------- // Test a short walk that should not register { memset(minute_raw_data, 0, k_minute_data_bytes); s_num_captured_activity_sessions = 0; time_t now = rtc_get_time(); int len...
{ uint16_t vmc = samples[i].vmc; // Convert from the old compressed VMC to the new uncompressed one vmc = vmc * vmc * 1850 / 1250; kalg_activities_update(s_kalg_state, now, samples[i].steps, vmc, samples[i].orientation, samples[i].plugged_in, 0 /*res...
cl_assert_equal_i(stats.sleep_start_utc, k_sleep_start_utc); cl_assert_equal_i(stats.sleep_len_m, k_sleep_end_m - k_sleep_start_m); cl_assert_equal_i(stats.uncertain_start_utc, 0); } now += SECONDS_PER_MINUTE; rtc_set_time(now); } kernel_free(s_kalg_state); s_kalg_state = NULL; } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(TEST_PBI_FILE)
; cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); } // Tests 8-bit transparent PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_pbi__color_8_bit_transparent(void) { GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); }
i(s_num_captured_activity_sessions, 0); } // -------------------------------------------------------------------------------------- // Test a walk of 20 minutes followed by a run of 20 minutes { memset(minute_raw_data, 0, k_minute_data_bytes); s_num_captured_activity_sessions = 0; time_t now = rtc_...
cl_assert_equal_i(stats.sleep_start_utc, k_sleep_start_utc)
; cl_assert_equal_i(stats.sleep_len_m, k_sleep_end_m - k_sleep_start_m); cl_assert_equal_i(stats.uncertain_start_utc, 0); } now += SECONDS_PER_MINUTE; rtc_set_time(now); } kernel_free(s_kalg_state); s_kalg_state = NULL; }
ata->callback_context); } i18n_free_all(data); task_free(data); data = NULL; } static void prv_time_picker_window_appear(Window *window) { AlarmEditorData *data = (AlarmEditorData *)window_get_user_data(window); const bool is_smart = (data->alarm_type == AlarmType_Smart); const char *label = (!data->crea...
i18n_get("New Alarm", data)
; OptionMenu *option_menu = settings_option_menu_create( title, OptionMenuContentType_Default, 0, &callbacks, ARRAY_LENGTH(s_type_labels), false /* icons_enabled */, s_type_labels, data); PBL_ASSERTN(option_menu); data->alarm_type_menu = option_menu; option_menu_set_highlight_colors(option_menu, ALA...
TN(num_minutes_captured < *minute_data_len); minute_data_array[num_minutes_captured++] = minute_data; // ---------------------------------------------------- // Free state kernel_free(s_kalg_state); s_kalg_state = NULL; *minute_data_len = num_minutes_captured; return total_steps; } // ----------------...
(token, "//")
s/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations u...
prv_reset_local_session_ptrs()
; dls_clear(); prv_schedule_retry(); return NULL; } return dls_session; } static void prv_dls_log(AnalyticsHeartbeat *device_hb, AnalyticsHeartbeatList *app_hbs) { dls_log(s_device_heartbeat_session, device_hb->data, 1); #ifdef ANALYTICS_DEBUG analytics_heartbeat_print(device_hb); #endif kernel_f...
DCDC_V18_ENABLE_HV, 0x1); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_ENABLE_LV, 0x0); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_CUR_LIM_MAX_LV, 0xF); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMP...
REG_SETF(CRG_TOP, BOD_STATUS_REG, BOD_1V8_PA_LOW, 0x0)
; REG_SETF(CRG_TOP, BOD_STATUS_REG, BOD_VDD_LOW, 0x0); REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_BLE_SLEEP, 0x0); // GUESS REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_FTDF_SLEEP, 0x0); // GUESS REG_SETF(CRG_TOP, LDOS_DISABLE_REG, LDOS_DISABLE, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_HOLD_AMP_REG,...
n.header.id, &s_extra_case_items[2].header.id)); cl_assert(!iter_next(&iterator)); } // 8:16 am, 8:00 event has passed but not 8:15 event void test_timeline__extra_case_middle_past(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; t...
pin_db_delete((uint8_t *)&s_items[4].header.id, sizeof(Uuid))
, 0); // next item should be items[5], going back should skip over items[4] cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); cl_assert(state.node); timeline_iter_deinit(&iterator, &stat...
on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "hc_protocol/hc_endpoint_gap_service.h" #include "comm/ble/gap_le_connection.h" #include "kernel/pbl_ma...
(HcEndpointID_GapService, msg_id, NULL, 0)
; if (response) { HcProtocol_GapServiceGeneratePrivateResolvableAddressResponse *payload = (HcProtocol_GapServiceGeneratePrivateResolvableAddressResponse *) response->payload; *address_out = payload->address; success = true; } kernel_free(response); return success; }
a_len, uint8_t *data) { return i2c_read_register_block(I2C_MAG3110, reg_addr, data_len, data); } static bool mag3110_write(uint8_t reg_addr, uint8_t data) { return i2c_write_register_block(I2C_MAG3110, reg_addr, 1, &data); } static void mag3110_interrupt_handler(bool *should_context_switch) { if (s_use_refcount...
(DR_STATUS_REG, sizeof(raw_data), raw_data)
) { rv = MagReadCommunicationFail; goto done; } // TODO: shouldn't happen at low sample rate, but handle case where some data // is overwritten if ((raw_data[0] & 0xf0) != 0) { PBL_LOG(LOG_LEVEL_INFO, "Some Mag Sample Data was overwritten, " "dr_status=0x%x", raw_data[0]); rv = MagR...
S_PER_SECOND), ACTIVITY_CALORIES_PER_KCAL); // Make sure that the new_active_kcalories has increased workout_service_get_active_kcalories(&new_active_kcalories); cl_assert(active_kcalories < new_active_kcalories); // Double check that we calculated the same value that the workout service got c...
(113, HRMQuality_Good)
nd. cl_assert_equal_b(shared_prf_storage_get_valid_page_number(), 0); } // Sets the getting started field, then corrupts the ble_pairing_data crc // This tests that when setting a value, all fields in the struct must be valid. void test_shared_prf_storage_v3__handle_currupt_field_during_setting(void) { bool GETTIN...
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0)
D_INVALID; prv_file_each(prv_get_first_ancs_bonding_itr, &first_ancs_supported_bonding_found); return first_ancs_supported_bonding_found; } bool bt_persistent_storage_is_ble_ancs_bonding(BTBondingID bonding) { BtPersistBondingData data; prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data)); if (data...
(bonding, op)
; if (!bt_ctl_is_bluetooth_running()) { return; } prv_call_common_bonding_change_handlers(bonding, op); } typedef struct { BTDeviceAddress address; BTBondingID key_out; } KeyForBTCAddrData; static bool prv_get_key_for_bt_classic_addr_itr(SettingsFile *file, ...
// continue iterating } if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { check->wakeup_count++; } // If the wakeup_id is with the same minute as another wakeup event if ((entry.timestamp - WAKEUP_EVENT_WINDOW < check->wakeup_timestamp) && (check->wakeup_timestamp < (entry.ti...
{ return E_DOES_NOT_EXIST; }
time_t return_time = entry.timestamp; if (prv_compiled_without_utc_support()) { // Legacy apps expect everything in local time. return_time = time_utc_to_local(return_time); } return return_time; } void wakeup_enable(bool enable) { bool was_enabled = s_wakeup_enabled; s_wakeup_enabled = enable; ...
d_regs; // The following structures are accessed below in __asm. Because the Cortex-M0 doesn't handle // unaligned accesses automatically, and we don't want to do it ourselves, let's force the // elements we care about to be aligned correctly. typedef struct { int8_t padding[3]; CoreDumpThreadInfo ti; } CoreDumpTh...
hw_cpm_enable_clockless()
; hw_cpm_disable_xtal32k(); SCB->SCR |= (1 << 2); cm_sys_clk_sleep(true); hw_cpm_pll_sys_off(); hw_cpm_activate_pad_latches(); hw_cpm_power_down_periph_pd(); hw_cpm_wait_per_power_down(); hw_cpm_wait_rad_power_down(); hw_cpm_rfcu_clk_off(); hw_cpm_disable_rc16(); hw_cpm_dcdc_off(); hw_cpm_ldo_io...
ibutesMsg*)s_message_dict)->notification_uid; const uint32_t app_name_title_dict_uid = ((GetNotificationAttributesMsg*)s_app_name_title_dict)->notification_uid; const uint32_t unknown_app_message_dict_uid = ((GetNotificationAttributesMsg*)s_unknown_app_dict)->notification_uid; const uint32_t unknown_app_unique_ti...
(s_app_name_title_dict)
, (uint8_t *)s_app_name_title_dict); s_num_ds_notifications_received++; } else if (uid == unknown_app_message_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_unknown_app_dict), (uint8_t *)s_unknown_app_dict); s_num_ds_notifications_received++; } else if (uid == unknown_app_unique_title_dic...
ed-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpOr, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_or-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); ...
memset(dest_data, GColorBlack.argb, sizeof(dest_data))
; bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorBlack); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_black_cross_black_corners-expect.8bit.pbi")); memset(dest_data, GColorBlack.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, s...
_RESOURCE_NOTIFICATION_FACEBOOK_MESSENGER, TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK, TIMELINE_RESOURCE_NOTIFICATION_MAILBOX, TIMELINE_RESOURCE_NOTIFICATION_GENERIC, }; char *titles[] = { "Angela Tam", "Liron Damir", "Heiko Behrens", "Kevin Conley", "Matt Hungerford", }; char *bodies[] = {...
(&list, AttributeIdBroadcaster, "ABC")
(RECOVERY_FW) static time_t prv_clock_dstrule_to_timestamp( bool is_end, const TimezoneInfo *tz_info, const TimezoneDSTRule *rule, int year) { struct tm time_tm = { .tm_min = rule->minute, .tm_hour = rule->hour, .tm_mday = rule->mday, .tm_mon = rule->month, .tm_year = year, .tm_gmtoff = 0...
(region_id, tz_info)
; prv_update_dstrule_timestamps_by_dstzone_id(tz_info, utc_time); #endif } static TimezoneInfo prv_get_timezone_info_from_data(TimezoneCBData *tz_data) { int region_id = -1; if (tz_data->region_name_len) { region_id = timezone_database_find_region_by_name(tz_data->region_name, ...
v_lock(void) { mutex_lock_recursive(s_analytics_lock); } static void prv_unlock(void) { mutex_unlock_recursive(s_analytics_lock); } // Analytic Node Functions static bool prv_compare_analytic(ListNode *found_node, void *data) { AnalyticsNode *node = (AnalyticsNode *)found_node; return (node->metric == (Dialo...
prv_unlock()
; } void analytics_stopwatches_update(uint32_t current_ticks) { prv_lock(); ListNode *cur = s_stopwatch_list; while (cur != NULL) { AnalyticsStopwatchNode *node = (AnalyticsStopwatchNode *)cur; analytics_add(node->metric, prv_stopwatch_elapsed_ms(node, current_ticks)); node->starting_ticks = current...
/* * 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_s(dstbuf, "0zero1")
; // Variable length character output snprintf(dstbuf, 256, "There are %*d lights", 3, 4); cl_assert_equal_s(dstbuf, "There are 4 lights"); // Left-align, Variable length character output snprintf(dstbuf, 256, "There are %*d lights", -3, 4); cl_assert_equal_s(dstbuf, "There are 4 lights"); // Varia...
0; s_last_event = (PebbleEvent) { 0 }; s_num_packets_sent = 0; s_num_bytes_sent = 0; s_log_message_buffer[0] = '\0'; s_in_critical_section = false; pulse_logging_init(); } void test_pulse_logging__simple(void) { pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "Test"); cl_assert_equal_i(s_num_event_puts, ...
cl_assert_equal_i(s_num_packets_sent, 0)
; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestE"); cl_assert_equal_i(s_num_event_puts, 1); cl_assert_equal_i(s_num_packets_sent, 0); pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestF"); cl_assert_equal_i(s_num_event_puts, 1); cl_ass...
lse; } const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t resource_id, uint32_t *num_bytes_out) { return NULL; } // Get the path of the filename before the extension size_t prv_get_base_path(const char *filename, char *base) { char *ext = strrchr(filena...
("Failed to read PDC size: %s\n", filename)
HIC_18); return (StatusBarTextFormat) { .overflow_mode = GTextOverflowModeTrailingEllipsis, .text_alignment = GTextAlignmentCenter, .font = fonts_get_system_font(font_key), }; } static int prv_height(void) { const PlatformType platform = process_manager_current_platform(); return _STATUS_BAR_LAYER_...
gcolor_equal(status_bar_layer->config.background_color, background)
ence, bitmap, 12345 * 100); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(88))); #endif } // Tests APNG file with 8-bit color, 5 frames and loop = 1 // Tests gbitmap_sequence_update_bitmap_by_elapsed with 0 delay frames for 1, 4 and 5 // and 2 & 3 have delay 1000ms // Result: // ...
cl_assert(bitmap_sequence)
; GBitmap *bitmap = gbitmap_create_blank(orig_bounds.size, GBitmapFormat8BitCircular); cl_assert(bitmap); // Shift the bounds when updating gbitmap_set_bounds(bitmap, shift_bounds); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); // set the original bounds to do whole-image compa...
atchface_launch_default(transition); #endif } static void prv_cleanup_timer(EventedTimerID *timer) { if (evented_timer_exists(*timer)) { evented_timer_cancel(*timer); *timer = EVENTED_TIMER_INVALID_ID; } } static void prv_exit_timer_callback(void *context) { TimelineAppData *data = context; data->time...
peek_layer_create_play_animation(&data->peek_layer)
; #else // Play only a section to reduce the duration to the scaling, ignoring the PDCS duration return (Animation *)peek_layer_create_play_section_animation(&data->peek_layer, 0, duration); #endif } static Animation *prv_create_sidebar_animation(TimelineAppData *data, bool open) { int16_t to_sidebar_width; if...
ed_S16_3) { .integer = h_range->origin_x, }; const Fixed_S16_3 fixed_x2 = (Fixed_S16_3) { .integer = h_range->origin_x + h_range->size_w, }; graphics_private_draw_horizontal_line_prepared(ctx, &ctx->dest_bitmap, &ctx->dest_bitmap.bounds, ...
prv_debug_perimeter(ctx, &perimeter_horizontal_range, line)
; // protect against range expanding: clip perimeter to the original text range grange_clip((GRange*)&perimeter_horizontal_range, (GRange*)&text_horizontal_range); text_horizontal_range = perimeter_horizontal_range; // convert range back to screen space text_horizontal_range.origin_x -= ...
= 0x80; static const unsigned int DISP_MODE_CLEAR = 0x20; // We want the SPI clock to run at 2MHz by default static uint32_t s_spi_clock_hz; // DMA constants static DMA_Stream_TypeDef* DISPLAY_DMA_STREAM = DMA1_Stream4; static const uint32_t DISPLAY_DMA_CLOCK = RCC_AHB1Periph_DMA1; static bool s_initialized = false...
prv_display_context_init(&s_display_context)
; vSemaphoreCreateBinary(s_dma_update_in_progress_semaphore); dma_request_init(SHARP_SPI_TX_DMA); prv_enable_display_spi_clock(); prv_display_start(); prv_disable_display_spi_clock(); s_initialized = true; } static void prv_display_context_init(DisplayContext* context) { context->state = DISPLAY_STA...
32, 64}, { -992, 16, 40}, { -1128, -8, 72}, { -1296, -248, 248}, { -1144, -280, 192}, { -1528, 144, 24}, { -1216, 328, -264}, { -1296, 224, -424}, { -1280, -80, -88}, { -968, -248, -56}, { -936, 0, -88}, { -864, 280, -32}, { -904, 384, -32}, { -1016, 392, -64}, { ...
ARRAY_LENGTH(samples)
e, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_begin_no_inbox(void) { cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)); cl_assert_equal_b(fals...
(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE))
; // After ending the write, expect num_success to be incremented by one: app_inbox_service_end(AppInboxServiceTagUnitTest); cl_assert_equal_i(1, app_inbox_service_num_success_for_tag(AppInboxServiceTagUnitTest)); cl_assert_equal_i(0, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); prv_pro...
m_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); fake_event_service_handle_last(); unobstructed_area_service_did_change(to_area.size.h); fake_event_service_handle_last(); cl_assert_equal_i(s_dat...
GRect(0, 0, 400, 400)
/* * 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...
{ case AnalyticsEvent_AppOOMNative: case AnalyticsEvent_AppOOMRocky: return true; default: // Don't allow any other event types: return false; }
} DEFINE_SYSCALL(void, sys_analytics_logging_log_event, AnalyticsEventBlob *event_blob) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(event_blob, sizeof(*event_blob)); } if (!prv_is_event_allowed(event_blob)) { syscall_failed(); } analytics_logging_log_event(event_blob); } DEFINE_...
/* * 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...
(GPIOC, GPIO_PinSource11, GPIO_AF_USART3)
; /* Configure USART Tx as alternate function */ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_Init(GPIOC, &GPIO_I...
fig[PercentTierCount] = { [PercentTier_AboveAverage] = { .num_variants = 5, .variants = { /// Sleep notification on wake up, slept above their typical sleep duration i18n_noop("Refreshed? You slept for %dH %dM which is %d%% above your typical. " "Go tackle your day 😃."...
snprintf(body, max_notif_length, i18n_get(fmt, body), hours, minutes, ABS(percentage))
; i18n_free_all(body); const NotificationConfig config = { .notif_time = notif_time, .insight_type = ActivityInsightType_SleepSummary, .icon_id = TIMELINE_RESOURCE_SLEEP, .body = body, .open_app = { .enabled = true, .health_card_type = HealthCardType_Sleep, }, }; analytics_...
cond_of_day); } else { // It is after 9pm, so use the 9pm cutoff first_sleep_utc = start_of_today_utc + last_sleep_second_of_day; } // Compute stats for today ActivitySleepStats stats; prv_compute_sleep_stats(now_utc, first_sleep_utc /*min_utc*/, now_utc /*max_utc*/, &stats); *enter_utc = stats.ent...
{ mutex_lock_recursive(state->mutex); SettingsFile *file = activity_private_settings_open(); if (file) { for (int i = 0; i < ActivityClassCount; i++) { ActivityClassParams *params = &class_settings[i]; status_t result = settings_file_set(file, &params->key, sizeof(params->key), ...
} // ------------------------------------------------------------------------------------------------ // Load in the stored activities from our settings file void activity_sessions_prv_init(SettingsFile *file, time_t utc_now) { ActivityState *state = activity_private_state(); ActivitySettingsKey key = ActivitySe...
, SmartstrapResult result, const uint8_t *data, size_t length) { cl_assert(data == (uint8_t *)attribute); cl_assert(result == SmartstrapResultOk); cl_assert(s_pending_did_read.active); cl_assert(s_pending_did_read.attribute == attribute); cl_assert(s_pending_did_read.length ==...
cl_assert(app_smartstrap_attribute_get_service_id(attr) == 0)
; cl_assert(app_smartstrap_attribute_get_attribute_id(attr) == 0); } void test_app_smartstrap__create_duplicate(void) { // create the attribute once SmartstrapAttribute *attr = app_smartstrap_attribute_create(0x1111, 0x2222, 100); cl_assert(attr != NULL); // try to create it again SmartstrapAttribute *att...
/* * 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...
buffer_create(buffer_size)
; int bytes_written = 0; int num_elements = buffer_size / sizeof(test_data); for (int i = 0; i < num_elements; ++i) { cl_assert_equal_i(b->bytes_written, i * sizeof(test_data)); cl_assert_equal_i(buffer_get_bytes_remaining(b), buffer_size - (i * sizeof(test_data))); bytes_written += buffer_add(b, (ui...
/* * 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_health_service_event_handler, health_app_data)
ing_did_write = (PendingInfo) { .active = true, .attribute = attribute }; } static void prv_did_write_handler(SmartstrapAttribute *attribute, SmartstrapResult result) { cl_assert(result == SmartstrapResultOk); cl_assert(s_pending_did_write.active); cl_assert(s_pending_did_write.attribute == attribute);...
app_smartstrap_attribute_destroy(attr)
; // destroy again (shouldn't do anything bad) app_smartstrap_attribute_destroy(attr); } void test_app_smartstrap__read(void) { // create the attribute SmartstrapAttribute *attr = app_smartstrap_attribute_create(0x1111, 0x2222, 100); // start a read request stub_pebble_tasks_set_current(PebbleTask_App); ...
{ if (dev->state->fast_read_ddr_enabled) { *instruction = dev->state->part->instructions.fast_read_ddr; *dummy_cycles = dev->state->part->dummy_cycles.fast_read_ddr; *is_ddr = true; } else { *instruction = dev->state->part->instructions.fast_read; *dummy_cycles = dev->state->part->dummy_cycles.f...
static void prv_read_mmap_with_params(QSPIFlash *dev, uint32_t addr, void *buffer, uint32_t length, uint8_t instruction, uint8_t dummy_cycles, bool is_ddr) { qspi_mmap_start(dev->qspi, instruction, addr, dummy_cycles, length, is_ddr); // Point the buffer at the QSPI region ...
ocus // lost event. PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, false); cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, tr...
(app_stack)
, 0); window_destroy(window1); window_destroy(window2); } // Tests modal and app transitions with an unfocusable modal window void test_window_stack__unfocusable_modal_and_app(void) { Window *window1 = window_create(); Window *window2 = window_create(); cl_assert_equal_b(window_is_focusable(window2), true);...
"); return false; } delay_us(100); } return true; } static bool prv_reset_into_nvcm(void) { // Reset the FPGA and wait for it to program itself via NVCM. // NVCM configuration is initiated by pulling CRESET high while SCS is high. GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); // CRESET nee...
(SCENE_BLACK)
; ASSERT_BUSY_IS(Bit_RESET); dbgserial_print("Does releasing reset allow draw-scene commands " "to function again? "); prv_start_command(CMD_RESET_RELEASE); prv_end_command(); prv_draw_scene(SCENE_BLACK); ASSERT_BUSY_IS(Bit_SET); dbgserial_print("Does the draw-scene command complete? "...
emory_layout.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_resources.h" #include "stubs_ui_window.h" #include "stubs_unobstructed_area.h" void framebuffer_clear(FrameBuffer* f) {} void graphics_context_move_draw_box(GContext* ctx, GPoint offset) {} typedef ...
cl_assert(resource_id != UINT32_MAX)
; KinoReel *kino_reel = kino_reel_create_with_resource(resource_id); cl_assert(kino_reel); cl_assert(kino_reel_get_type(kino_reel) == KinoReelTypePDCS); kino_reel_set_elapsed(kino_reel, 0); GDrawCommandList *list1 = kino_reel_get_gdraw_command_list(kino_reel); GDrawCommandList *list1_direct = gdraw_comman...
cognizers attached to children of active layer will not be evaluated manager.active_layer = &layer_a; cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {2, 3}, 2, &s_recognizers_handled); // Recognizers attached to active layer will ...
(prv_fail_recognizer(r1, &ctx))
; cl_assert_equal_i(r1->state, RecognizerState_Failed); r1->state = RecognizerState_Possible; recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb); cl_assert(prv_fail_recognizer(r1, &ctx)); cl_assert_equal_i(r1->state, RecognizerState_Possible); cl_assert(ctx.recognizers_active); } void prv_ca...
reset peripheral and pin configuration during a bus reset) if (i2c_buses[bus_idx].user_count == 0) { bus_rail_power_down(bus_idx); } else { bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl); bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda); } } //! Perform a soft res...
{ // Disable all interrupts on the bus bus->i2c->CR2 &= ~(I2C_CR2_ITEVTEN | I2C_CR2_ITERREN | I2C_CR2_ITBUFEN); // Generate a stop condition bus->i2c->CR1 |= I2C_CR1_STOP; bus->transfer.state = TRANSFER_STATE_INVALID; }
//! Set up and start a transfer to a device, wait for it to finish and clean up after the transfer has completed static bool do_transfer(I2cDevice device_id, bool read_not_write, uint8_t device_address, uint8_t register_address, uint8_t size, uint8_t *data) { PBL_ASSERTN(s_initialized); PBL_ASSERTN(device_id < BO...
if we needed expected_crc = crc32(expected_crc, &data[i], 1); dialog_spi_send_and_receive_byte(data[i]); } dialog_spi_end_cmd(); uint32_t received_crc = 0; dialog_spi_receive_data((uint8_t *)&received_crc, sizeof(received_crc)); if (received_crc != expected_crc) { PBL_LOG(LOG_LEVEL_ERROR, "Load...
(SYSTEM_APP, RESOURCE_ID_BT_FW_IMAGE, 0x0, (uint8_t *)&info, sizeof(info))
) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to receive object bin info"); return false; } PBL_LOG(LOG_LEVEL_INFO, "Loading BT FW image to 0x%x. VT Size: %"PRIu32, (int)info.load_start_address, info.vector_table_size); if (!prv_load_and_transfer_vector_table(info.vector_table_size)) { return fal...
nt to "pretend" that we rebooted, // and make sure that the contents of the settings_file are not corrupted // in any way. // Simulate a reboot by clearing out PFS's state. fake_spi_flash_force_future_failure(0, NULL); extern void pfs_reset_all_state(void); pfs_reset_all_state(); pfs_init(f...
atoi((char*)val + 1)
; cl_assert_equal_i(key_i, val_i); return true; } void test_settings_file__each(void) { printf("\nTesting if we can use each...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_each", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0...
_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10)); setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); } void test_graphics_context_${BIT_DEPTH_NAME}__draw_st...
graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, 2)
); #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, 2)); #endif setup_test(&context, true, 2, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80,...
ight; } if (x > bm_p1.x.integer) { // We're crossing far_bottom point, time to swap... bm_p0 = far_bottom; bm_p1 = far_right; } // Starting and ending point of the line, initialized with extremes Fixed_S16_3 top_margin = {.raw_value = INT16_MAX}; Fixed_S16_3...
(ctx, GPointPreciseFromGPoint(p0), GPointPreciseFromGPoint(p1), stroke_width, false)
; } #if PBL_COLOR MOCKABLE void graphics_line_draw_precise_stroked_aa(GContext* ctx, GPointPrecise p0, GPointPrecise p1, uint8_t stroke_width) { prv_draw_stroked_line_override_aa(ctx, p0, p1, stroke_width, true); } #endif // PBL_COLOR MOCKABLE void graphics_line_d...
/* * 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_ASSERTN(out_error); // Search for end of the App ID before checking that all attributes are present. while (length > 0) { length--; if (*data++ == 0) { break; } } if (length == 0) { *out_error = false; return false; } return ancs_util_get_attr_ptrs(data, length, ...
bool ancs_util_get_attr_ptrs(const uint8_t* data, const size_t length, const FetchedAttribute* attr_list, const int num_attrs, ANCSAttribute *out_attr_ptrs[], bool* out_error) { PBL_ASSERTN(out_error); *out_error = false; const uint8_t* iter = data; if (length < sizeof(ANCSAttribute)) { PBL_LOG(LOG_...
al_i(GColorBlackARGB8, gcolor_get_grayscale(GColorBlack).argb); cl_assert_equal_i(GColorLightGrayARGB8, gcolor_get_grayscale(GColorLightGray).argb); cl_assert_equal_i(GColorDarkGrayARGB8, gcolor_get_grayscale(GColorDarkGray).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_grayscale(GColorYellow).argb); cl...
cl_assert(gcolor_equal(gcolor_tint_using_luminance_and_multiply_alpha(src_color, tint_color), expected_result_color))
; } void test_graphics_colors__tint_using_luminance_and_perform_lookup_using_color_luminance(void) { // Passing in NULL for lookup_table should assert cl_assert_passert(gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(GColorRed, ...
offset_in_log_page + s_curr_state.page_start_addr; s_curr_state.bytes_remaining = msg_length; prv_write_flash_log_record_header(msg_length); return (s_curr_state.log_start_addr); } bool flash_logging_write(const uint8_t *data_to_write, uint32_t flash_addr, uint32_t read_length) { if ((s_curr_state...
(status == DumpStatus_DoneSuccess)
; kernel_free(state); } else { // Keep going system_task_add_callback(prv_dump_log_system_cb, state); } } bool flash_dump_log_file(int generation, DumpLineCallback line_cb, DumpCompletedCallback completed_cb) { uint8_t log_file_id = generation_to_log_file_id(generation); ...
x0}, { 10, 0x54, 1667, 0x0}, { 0, 0x44, 1434, 0x0}, { 0, 0x64, 281, 0x0}, { 0, 0x34, 1327, 0x0}, { 0, 0x34, 3331, 0x0}, { 0, 0x24, 2970, 0x0}, { 0, 0x14, 466, 0x0}, { 0, 0x24, 3187, 0x0}, { 0, 0x34, 1349, 0x0}, { 0, 0x14, 634, 0x0}, { 0, 0x36, 2967, 0x0}, { 0, 0x54, 349, ...
{ 0, 0x81, 3812, 0x0}, { 0, 0x81, 4377, 0x0}, { 0, 0x72, 4265, 0x0}, { 10, 0x77, 7206, 0x0}, // 195: Local time: 10:13:00 PM { 0, 0x64, 3133, 0x0}, { 17, 0x84, 3387, 0x0}, { 0, 0x84, 3139, 0x0}, { 12, 0x82, 3025, 0x0}, { 0, 0x82, 4650, 0x0}, { 0, 0x83, 3944, 0x0}, { 0, 0x...
{ 0, 0x45, 2783, 0x0}, { 0, 0x40, 306, 0x0}, { 0, 0x43, 3192, 0x0}, { 0, 0x47, 612, 0x0}, { 8, 0x56, 8141, 0x0}, { 0, 0x61, 6267, 0x0}, { 0, 0x6e, 2769, 0x0}, { 6, 0x7e, 2853, 0x0}, { 0, 0x5f, 1339, 0x0}, { 8, 0x5f, 1323, 0x0}, // 255: Local time: 11:13:00 PM { 0, 0x7f, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR)
; current_value |= bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } void boot_bit_clear(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); current_value &= ~bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } bool boot_bit_test(BootBitVa...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "Test")
; cl_assert_equal_i(s_num_event_puts, 0); cl_assert_equal_i(s_num_packets_sent, 1); cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 4); cl_assert_equal_s(s_log_message_buffer, "Test"); s_num_bytes_sent = 0; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTest"); cl_assert_equal_i(...
, 664, -6}, { 1052, 492, 83}, { 1256, 562, 29}, { 1249, 576, 57}, { 1146, 470, 128}, { 1058, 325, 162}, { 1042, 206, 202}, { 1011, 165, 242}, { 936, 143, 252}, { 899, 173, 229}, { 907, 178, 234}, { 1051, 181, 268}, { 1070, 193, 208}, { 1200, 200, 201}, { 1216, 253...
{ 855, 151, 242}, { 965, 158, 278}, { 1100, 163, 306}, { 1075, 206, 197}, { 1294, 282, 155}, { 1185, 320, 37}, { 1132, 429, -197}, { 1078, 352, -113}, { 888, 263, 9}, { 773, 239, 23}, { 804, 261, 26}, { 835, 320, 52}, { 848, 377, 15}, { 882, 364, -17}, { 895, ...
/* * 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)
20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_rows_no_clip"))); // Odd rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSE...
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_even_cols_no_clip")
)); // Odd cols of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(...
/* * 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 (data->alarm_id == ALARM_INVALID_ID && data->complete_callback) { data->complete_callback(CANCELLED, data->alarm_id, data->callback_context); } }
ut. if (*fmt == '0' || *fmt == '+') { pad = *fmt++; } // Process field width if (*fmt >= '1' && *fmt <= '9') { width = strtol(fmt, &ptr, 10); fmt = ptr; } // Process modifiers (SU) if (*fmt == 'E' || *fmt == 'O') { // We just drop them on the floor. Uh oh spaghetti-...
(t->tm_yday+1, 3, INTFMT_PADZERO)
; break; case 'k': // TZ FMT_INTCOPY(t->tm_hour, 2, INTFMT_PADSPACE); break; case 'l': // TZ FMT_INTCOPY(hour_12h, 2, INTFMT_PADSPACE); break; case 'm': FMT_INTCOPY(t->tm_mon + 1, 2, INTFMT_PADZERO); break; case 'M': FMT_INTCOPY(t->...
// PBL-42540: This property is dependent on the screen size. .thin_pin_height = 88, .day_sep_dot_diameter = 12, .day_sep_offset.y = -21, .past_day_sep_dot_offset_y = -16, .future_day_sep_dot_offset_y = 16, }; static const TimelineLayerStyle * const s_styles[NumPreferredContentSizes] = { [PreferredContent...
{ prv_get_frame(layer, index, frame); const bool is_future = (layer->scroll_direction == TimelineScrollDirectionDown); const TimelineLayerStyle *style = prv_get_style(); gpoint_add_eq(&frame->origin, GPoint(style->fin_offset_x, is_future ? style->future_fin_offset_y : styl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window, WINDOW_NAME("Kino Layer"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .appear = prv_window_appear, }); window_set_click_config_provider_with_context(window, prv_click_config_provider, data); app_window_stack_push(window, true /*animated*/); } static vo...
64}, { 264, 1256, 296}, { 200, 1096, 512}, { 16, 1544, 296}, { -56, 1032, 208}, { -40, 928, 208}, { -48, 624, 176}, { -88, 584, 168}, { -152, 904, 184}, { 16, 848, 200}, { 80, 776, 208}, { 8, 896, 216}, { -80, 1008, 280}, { -248, 1176, 208}, { -184, 1152, 88}, ...
{ 80, 808, -48}, { 80, 664, -192}, { 96, 440, -104}, { 128, 440, 32}, { 232, 768, 24}, { -40, 904, 96}, { 288, 552, 264}, { 416, 1096, 200}, { 272, 1080, 272}, { 392, 1384, 288}, { 184, 1272, 440}, { -48, 1640, 720}, { 224, 1480, 496}, { 208, 984, 312}, { 184,...
{ 176, 192, -56}, { 152, 832, 88}, { 40, 1000, 240}, { 32, 1144, 360}, { -128, 1136, 232}, // 68 seconds { -72, 992, 96}, { -128, 1024, 160}, { -248, 1248, 232}, { -232, 1176, 144}, { -192, 1000, -8}, { -104, 920, -88}, { 24, 424, 72}, { 104, 616, -72}, { 120...
test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } #define OFFSET_RECT_NO_CLIP GRect(10, 10, 40, 50) #define OF...
graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornerBottomLeft)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornerBottomRight); cl_check(gbitma...
d test_ancs__should_handle_split_timestamp_messages(void) { prv_send_notification((uint8_t *)&s_split_timestamp_dict_part_one); cl_assert_equal_i(s_num_requested_notif_attributes, 1); cl_assert_equal_i(s_num_ds_notifications_received, 2); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_...
prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification)
orsBuffer content_indicators_buffer; bool app_framebuffer_render_pending; AppFocusState app_focus_state; UnobstructedAreaState unobstructed_area_service_state; Layer* layer_tree_stack[LAYER_TREE_STACK_SIZE]; WakeupHandler wakeup_handler; EventServiceInfo wakeup_event_info; #if CAPABILITY_HAS_TOUCHSCR...
(app_state_get_health_service_state())
; #endif locale_init_app_locale(app_state_get_locale_info()); content_indicator_init_buffer(app_state_get_content_indicators_buffer()); unobstructed_area_service_init(app_state_get_unobstructed_area_state(), s_app_state_ptr->initial_obstruction_origin_y); #if CAPABILITY_HAS_AP...
/* * 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...
get_reminder_timer_id()
), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000); // ...until we insert item 1 back cl_assert(S_SUCCESS == reminders_insert(&item1)); cl_assert_equal_m(&item1.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)); cl_asser...
{ gpio_output_set(&ICE40LP->spi.scs, true); // SCS asserted (low) delay_us(100); prv_spi_write(&cmd, sizeof(cmd)); if (arg_len) { prv_spi_write(arg, arg_len); } gpio_output_set(&ICE40LP->spi.scs, false); // SCS not asserted (high) }
!shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123", 3, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 5); cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "456", 3, false))...
(shared_circular_buffer_get_write_space_remaining(&buffer), 6)
; // Make client2 fall behind cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abcdef", 6, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert(shared_circular_buffer_read(&buffer, &client1, 3, &out_buffer, &out_length)); cl_assert_equal_i(out_lengt...
cl_assert_equal_b(s_prv_activity_cb__args[0].activity, HealthActivityRun); // respect range s_prv_activity_cb__call_count = 0; s_sys_activity_get_sessions_values.out.num_sessions = 7; health_service_activities_iterate(HealthActivitySleep, now - (15 * SECONDS_PER_MINUTE), now, ...
(0 > prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast))
; // b ends later cl_assert(0 < prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 5}, &(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast)); } void test_health__get_minute_history_edge_case_args(void) { const time_t n...
CONDS_PER_MINUTE; if (exit_utc == deep_exit_utc) { results->in_deep_sleep.value = true; results->cur_state_elapsed.value = last_deep_session_len_m + unprocessed_m; } else { results->cur_state_elapsed.value = last_session_len_m + unprocessed_m; } } else { if (exit_utc != 0) { re...
{ break; }
now += SECONDS_PER_MINUTE; rtc_set_time(now); } time_t test_end_utc = now; time_t last_processed_utc = kalg_activity_last_processed_time(s_kalg_state, KAlgActivityType_Sleep); // Get summary of the sleep SleepTestResult...
s/simple_dialog.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/system_icons.h" #include "popups/ble_hrm/ble_hrm_stop_sharing_popup.h" #include "resource/resource_ids.auto.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/com...
app_simple_dialog_push(ble_hrm_stop_sharing_popup_create())
; } #endif // CAPABILITY_HAS_BUILTIN_HRM void settings_remote_menu_push(struct SettingsBluetoothData *bt_data, StoredRemote *stored_remote) { SettingsRemoteData *data = app_malloc_check(sizeof(SettingsRemoteData)); PBL_LOG(LOG_LEVEL_DEBUG, "NAME: %s", stored_remote->name); *data = (SettingsRemoteData){}; dat...
/* * 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 (md != NULL) { const PebbleProcessMd *app_process = app_manager_get_current_app_md(); if (uuid_equal(&md->uuid, &app_process->uuid)) { return APP_WORKER_RESULT_ALREADY_RUNNING; } // We have to get confirmation first that it is OK to launch the new worker launcher_task_add_callback(prv_swit...
worker_manager_put_launch_worker_event(install_id); worker_manager_set_default_install_id(install_id); return APP_WORKER_RESULT_SUCCESS; } // --------------------------------------------------------------------------------------------------------------- // Kill the worker for the current app DEFINE_SYSCALL(Ap...
/* * 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...
debug_print_str_and_int("Computed CRC: ", (int)crc)
; } static void prv_handle_load_data_command(void) { debug_print_str("LD CMD\n"); struct __attribute__((packed)) { uint32_t copy_address; uint32_t length; } send_data_cmd_payload = { }; prv_write_or_read_bytes(&send_data_cmd_payload, sizeof(send_data_cmd_payload), false); debug_p...
ugh all possible pages and keep writing new data, confirm it's the right data. for (uint32_t i = 0; i < SPRF_NUM_PAGES; i++) { shared_prf_storage_set_getting_started_complete(toggle); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), toggle); cl_assert_equal_i(shared_prf_storag...
(data.getting_started.crc != 0xFFFFFFFF)
; uint32_t new_crc = 0; flash_write_bytes((uint8_t *)&new_crc, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()) + offsetof(SharedPRFData, getting_started) + offsetof(SprfGettingStarted, crc),...
/* * 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 (icon) { const bool is_highlighted = action_bar_legacy2_is_highlighted(action_bar, index); if (is_highlighted) { graphics_context_set_fill_color(ctx, highlighted_color); GCornerMask corner; switch (index) { case 0: corner = GCornerTopLeft; break; case NUM_ACTIO...
rect.origin.y += rect.size.h; } } void action_bar_layer_legacy2_init(ActionBarLayerLegacy2 *action_bar) { *action_bar = (ActionBarLayerLegacy2){}; layer_init(&action_bar->layer, &GRectZero); action_bar->layer.update_proc = (LayerUpdateProc) action_bar_legacy2_update_proc; action_bar->layer.property_chan...
_app_state.h" #include "stubs_fonts.h" #include "stubs_graphics_context.h" #include "stubs_gbitmap.h" #include "stubs_heap.h" #include "stubs_text_resources.h" #include "stubs_text_render.h" #include "stubs_pbl_malloc.h" #include "stubs_reboot_reason.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include ...
{ Iterator char_iter; CharIterState char_iter_state; Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_state; // Skip over codepoints that aren't newline and < 0x20 bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\x02\x11\x41\nB\x01 \x02"); cl_as...