prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
nnectivity role to the phone, from Pebble's point of view. typedef enum { GAPLERoleSlave, GAPLERoleMaster, } GAPLERole; // ------------------------------------------------------------------------------------------------- // Static Variables -- MUST be protected with bt_lock/unlock! //! The list of connection inte...
{ GAPLEConnectionClient *client = &intent->client[c]; if (client->is_used) { *task_mask &= ~gap_le_pebble_task_bit_for_client(c); } }
} //! extern'd for gatt.c, used to determine to what tasks a "Buffer Empty" event should be sent. //! Helper function to build a PebbleTaskBitset task_mask of the clients' tasks that are virtually //! connected to specified real connection and therefore need to receive events for it. //! bt_lock is assumed to be take...
/* * 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...
(0, 0, 640, 64)
; static const GRect BITMAP_LAYER_BOUNDS = GRect(-32, 0, 640, 64); static const GRect BITMAP_BOUNDS = GRect(0, 0, 640, 64); GBitmap bitmap = { .bounds = BITMAP_BOUNDS, }; BitmapLayer layer; bitmap_layer_init(&layer, &BITMAP_LAYER_FRAME); bitmap_layer_set_bitmap(&layer, &bitmap); // set bounds with...
(!iter) { *max_client = NULL; return 0; } uint32_t max_data = 0; uint32_t len; while (iter) { len = prv_get_data_length(buffer, (SharedCircularBufferClient *)iter); if (len >= max_data) { *max_client = (SharedCircularBufferClient *)iter; max_data = len; } iter = iter->next...
if (data_length < length) { return false; }
client->read_index = (client->read_index + length) % buffer->buffer_size; return true; } // ------------------------------------------------------------------------------------------------- uint16_t shared_circular_buffer_get_write_space_remaining(const SharedCircularBuffer* buffer) { SharedCircularBufferClie...
/* * 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...
{ jerry_cleanup(); rocky_runtime_context_deinit(); fake_pbl_malloc_check_net_allocs(); // Make sure no memory was leaked }
ess_data1 status = prv_read_verify_halfword(stress_addr1, stress_data1, FLASH_TEST_ERR_DATA_WRITE, false); VERIFY_TEST_STATUS(status); halfwordcount++; // Confirm write took place - data should now be set to stress_data2 status = prv_read_verify_halfword(stress_addr2, stress_data2, FLASH_TEST_ERR_D...
prv_run_data_test()
; break; case FLASH_TEST_CASE_RUN_ADDR_TEST: status = prv_run_addr_test(); break; case FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST: status = prv_run_stress_addr_test(iterations); break; case FLASH_TEST_CASE_RUN_PERF_DATA_TEST: status = prv_run_perf_data_test(); break; ...
essor(stack, ARRAY_LENGTH(stack), &current_stack, false); cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // test limited stack size (go to sibling instead of child) stack[0] = a; current_stack = 0; actual = __layer_tree_traverse_next__test_accessor(sta...
cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a)
; cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(6, 6)), &child_d); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(15, 15)), &child_e); } static bool prv_override_layer_contains_point(const Layer *layer, const GPoint *point) { return true; } void test_layer__find_laye...
- (uint32_t) __stack_guard_size__ ) / sizeof(portSTACK_TYPE); TaskParameters_t task_params = { .pvTaskCode = main_task, .pcName = "KernelMain", .usStackDepth = kernel_main_stack_words, .uxPriority = (tskIDLE_PRIORITY + 3) | portPRIVILEGE_BIT, .puxStackBuffer = (void*)(uintptr_t)((uint32_t)...
if (!(r = setjmp(s_sjlj_jmpbuf))) prv_sjlj_first(r); else prv_sjlj_main(r);
PBL_ASSERT(s_sjlj_num == 3, "SJLJ TRACK INCORRECT @ END"); PBL_LOG(LOG_LEVEL_ALWAYS, "sjlj works \\o/"); } #endif static NOINLINE void prv_main_task_init(void) { // The Snowy bootloader does not clear the watchdog flag itself. Clear the // flag ourselves so that a future safe reset does not look like a watchd...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(data->window)
); app_timer_register(500, timer_callback, NULL); } static void handle_init(void) { AmbientLightAppData *data = task_malloc_check(sizeof(AmbientLightAppData)); data->window = window_create(); Layer *window_layer = window_get_root_layer(data->window); GRect bounds = window_layer->bounds; data->text_laye...
ListNode node; GDrawState draw_state; } Context2DStoredState; // TODO: PBL-35780 make this part of app_state_get_rocky_runtime_context() SECTION(".rocky_bss") static Context2DStoredState *s_canvas_context_2d_stored_states; T_STATIC jerry_value_t prv_create_canvas_context_2d_for_layer(Layer *layer) { JS_VAR contex...
prv_rect_precise_call(argc, argv, prv_draw_rect_impl)
; } JERRY_FUNCTION(prv_clear_rect) { GContext *const ctx = rocky_api_graphics_get_gcontext(); const GColor prev_color = ctx->draw_state.fill_color; ctx->draw_state.fill_color = GColorBlack; JS_VAR result = prv_rect_call(argc, argv, graphics_fill_rect); ctx->draw_state.fill_color = prev_color; return jerry_...
/* * 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...
(&qspi_com_config)
; prv_wait_for_qspi_transfer_complete(QSPIFlag_ClearTC); delay_us(12000); // 12ms reset if busy with an erase! // Return the flash to Quad SPI mode, all our commands are quad-spi and it'll just cause // problems/bugs for someone if it comes back in single spi mode prv_quad_enable(); } static bool prv_flas...
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0); prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good); prv_inc_time(10); prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_e...
(ActivitySessionType_Run)
); prv_put_bpm_event(140, HRMQuality_Good); prv_put_bpm_event(140, HRMQuality_Good); cl_assert(workout_service_get_avg_hr(&avg_hr)); cl_assert_equal_i(avg_hr, 140); prv_put_bpm_event(160, HRMQuality_Good); prv_put_bpm_event(160, HRMQuality_Good); cl_assert(workout_service_get_avg_hr(&avg_hr)); cl_asse...
typedef struct FileDesc { File file; uint16_t time_closed; //!< used for fd caching scheme uint8_t fd_status; } FileDesc; static FileDesc s_pfs_avail_fd[MAX_FD_HANDLES]; // All accesses to s_pfs_avail_fd should be handled through the PFS_FD macro. #define PFS_FD(fd) s_pfs_avail_fd[(fd)-FD_I...
{ return (page_type_bits_set(page_flags, DELETED_START_PAGE_MASK) || page_type_bits_set(page_flags, DELETED_CONT_PAGE_MASK)); }
e = TRANSFER_STATE_INVALID; bus->busy = false; return pdFALSE; } //! Pause a transfer, disabling interrupts during the pause //! Only call from interrupt functions static portBASE_TYPE pause_transfer_irq(I2cBus *bus) { bus->i2c->CR2 &= ~(I2C_CR2_ITEVTEN | I2C_CR2_ITERREN | I2C_CR2_ITBUFEN); bus->busy = false;...
if (bus->transfer.state == TRANSFER_STATE_INVALID) { // Disable interrupts if spurious interrupt received bus->i2c->CR2 &= ~I2C_CR2_ITERREN; return pdFALSE; }
// Data overrun and bus errors can only really be handled by terminating the transfer and // trying to recover bus to an idle state. Each error will be logged. In each case a stop // condition will be sent and then we will wait on the busy flag to clear (if it doesn't, // a soft reset of the bus will be perfo...
BL_ASSERTN(packet.address == address); PBL_ASSERTN(packet.footer == RAM_FLASH_FOOTER); return ntohs(packet.value); } #endif static void prv_write_ram(uint16_t address, uint16_t value) { address = htons(address); value = htons(value); MemoryPacket data = { .packet_id = PACKET_ID_RAM_WRITE, .address = ...
(&EWD1000->reset_gpio, true)
; prv_wait_for_interrupt(); // read the "Hello" message explicitly EventMessage message = { }; prv_read_data((uint8_t *)&message, sizeof(message)); PBL_ASSERTN(message.raw.data == HELLO_MESSAGE_DATA); // TODO: remove this assert once we're sure the controller FW is stable PBL_ASSERTN(message.raw.padding ...
/* * 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...
(0x8b0000)
}, {"darksalmon", GColorARGB8FromHEX(0xe9967a)}, {"darkseagreen", GColorARGB8FromHEX(0x8fbc8f)}, {"darkslateblue", GColorARGB8FromHEX(0x483d8b)}, {"darkslategray", GColorARGB8FromHEX(0x2f4f4f)}, {"darkslategrey", GColorARGB8FromHEX(0x2f4f4f)}, {"darkturquoise", GColorARGB8FromHEX(0x00ced1)}, {"darkviolet"...
scriberState *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 sensor // is currently stable if (stable_sensor) { state->last_valid_ticks = cur_ti...
PBL_ASSERTN(callback != NULL)
; } else if (current_task == PebbleTask_KernelMain) { // KernelMain clients can either set a callback, or use the event_service interface. } else { PBL_ASSERTN(current_task == PebbleTask_App || current_task == PebbleTask_Worker); is_app_subscription = true; } mutex_lock_recursive(s_manager_state.lo...
ed while the PutBytes message is written (between "prepare" // and "finish"), expect to receive a Nack: prv_receive_init(4, ObjectWatchApp); assert_ack_count(1); assert_nack_count(0); s_do_before_write = prv_cancel_before_write_second_message; const uint8_t payload[] = { 0xaa, 0xbb, 0xcc }; prv_receive...
prv_receive_init_cookie(VALID_OBJECT_SIZE, ObjectWatchWorker, EXPECTED_COOKIE)
; assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } void test_put_bytes__init_nack_upon_oom(void) { fake_malloc_set_largest_free_block(1024); // PutBytes allocates ~2K prv_receive_init(1024 * 1024, ObjectFirmware); fake_malloc_set_largest_free_block(...
/* * 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 (timer_cb) { return timer_cb; }
return s_current_work_cb; } //========================================================================================= // Initialize the timer service void new_timer_service_init(void) { PBL_LOG(LOG_LEVEL_DEBUG, "NT: Initializing"); vSemaphoreCreateBinary(s_wake_srv_loop); task_timer_manager_init(&s_task_t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
sys_resource_load_file_as_resource(TEST_IMAGES_PATH, GET_APNG_NAME)
; cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), GBitmapFormat8Bit); c...
BTCPairingData*) context; BTBondingID key; BtPersistBondingData stored_data; info->get_key(file, (uint8_t*) &key, info->key_len); info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersistBondingTypeBTClassic) { itr_data->cb(&stored...
if (!local_device_name) { return; }
shared_prf_storage_set_local_device_name(local_device_name); prv_file_set(&DEVICE_NAME_KEY, sizeof(DEVICE_NAME_KEY), local_device_name, size); } bool bt_persistent_storage_get_airplane_mode_enabled(void) { return prv_file_get_bool(&AIRPLANE_MODE_KEY, sizeof(AIRPLANE_MODE_KEY), fa...
/* * 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_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ, 0, 0)
; if (fd < 0) { PBL_LOG(LOG_LEVEL_WARNING, "pmap search (open) failed: %d", fd); return (fd); } int seek_result = seek_map(fd, callback, data); pfs_close(fd); return (seek_result); } static bool walk_max_used_id(PersistMapIdField *field, void *data) { int *max_used_id = data; if (field->id > *m...
-192, -48, -1000}, { -192, -40, -984}, { -192, -32, -992}, { -192, -40, -984}, { -192, -40, -992}, { -184, -64, -976}, { -208, -48, -992}, { -192, -64, -976}, { -200, -32, -984}, { -192, -16, -1000}, { -168, -16, -992}, { -160, -56, -1008}, // 171 seconds { -176, -56,...
{ -192, -24, -1000}, { -192, -32, -968}, { -192, -24, -992}, { -192, -24, -1000}, { -192, -24, -1000}, { -192, -24, -992}, { -184, -24, -984}, { -192, -24, -984}, { -192, -8, -992}, { -200, -16, -1000}, { -192, -48, -992}, // 177 seconds { -184, -40, -992}, { -184...
// ---------------------------------------------------------------- // Sample captured: 2015-10-05 17:50:12 local AccelRawData *activity_sample_non_walk_pbl_25659_15(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME non_walk_pbl_25659_15 //> TEST_EXPECTED 0 //> T...
/* * 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...
sort_bubble(array, ARRAY_LENGTH(array), sizeof(uint8_t), prv_uint8_cmp)
; uint8_t sorted[] = {1, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9}; cl_assert_equal_m(array, sorted, sizeof(array)); } void test_sort__int32_array(void) { int32_t array[] = {-9, 1, 8, 2, 7, 3, -6, 4, 6, 5, 5}; sort_bubble(array, ARRAY_LENGTH(array), sizeof(int32_t), prv_int32_cmp); int32_t sorted[] = {-9, -6, 1, 2, 3...
/* * 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 true; }
bool bt_driver_test_mfi_chip_selftest(void) { return false; } void bt_driver_core_dump(BtleCoreDump type) { }
fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert(prv_compare_points(&center, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_points)); prv_reset(); // set stroke width to zero - fill should be drawn, but not outline gdraw_command_s...
cl_assert_equal_i(s_circle_fill_count, 0)
return *cb_success; } // ------------------------------------------------------------------------------------------------ bool activity_init(void) { ACTIVITY_LOG_DEBUG("init"); s_activity_state = (ActivityState) {}; s_activity_state.mutex = mutex_create_recursive(); // This semaphore used to wake up the ...
(s_activity_state.mutex)
; return result; } // ------------------------------------------------------------------------------------------------ // Enable/disable this service. Used by the service manager's services_set_runlevel() call. // Note that this can be called from a timer callback so we do all the heavy lifting from a // kernel BG ...
s_gtransform_${BIT_DEPTH_NAME}__types_precise(void) { GPointPrecise pointP = GPointPreciseFromGPoint(GPoint(2, 5)); GPointPrecise pointP_c = GPointPrecise((2 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION, (5 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION); cl_ass...
gtransform_is_equal(&t_new, &t_c)
); // Test pointer re-use gtransform_concat(&t1, &t1, &t2); cl_assert(gtransform_is_equal(&t1, &t_c)); // Test concatenation of two non-identity matrices t1 = GTransformFromNumbers(3, 5, 7, 11, 13, 17); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(18, 26, 40, 58, 69, 10...
s; const size_t framebuffer_row_min_pixel = row_infos[state->row].min_x; const size_t framebuffer_row_max_pixel = row_infos[state->row].max_x; for (uint32_t i = 0; i < remaining_framebuffer_row_bytes; i++) { const uint32_t i_with_offset = i + framebuffer_current_column; if (WITHIN(i_with_offset,...
compositor_get_framebuffer()
, .row = 0, .col = 0, .width = DISP_COLS, .height = DISP_ROWS, }, .sent_header = false, }; screenshot_send_next_chunk(&s_screenshot_state); }
er the License. */ #include "services/common/cron.h" #include <pebbleos/cron.h> #include "os/mutex.h" #include "system/passert.h" #include "services/common/regular_timer.h" #include "system/logging.h" #include "util/math.h" //! Don't let users modify the list while callbacks are occurring. static PebbleMutex *s_lis...
prv_is_scheduled(new_job)
); // can't schedule after an unscheduled job PBL_ASSERTN(prv_is_scheduled(job)); // copy schedule info from existing job CronJob temp_job = *job; list_init(&temp_job.list_node); temp_job.cb = new_job->cb; temp_job.cb_data = new_job->cb_data; *new_job = temp_job; // insert after in the list, which g...
/* * 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...
gpio_use(GPIOB)
; gpio_use(GPIOD); gpio_use(GPIOE); GPIO_InitTypeDef gpio_init; if (enable_gpios) { gpio_init = s_default_at_flash_cfg; } else { gpio_init = (GPIO_InitTypeDef) { .GPIO_Mode = GPIO_Mode_AN, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_PuPd = GPIO_PuPd_NOPULL }; } // leave RESET_N a...
/* * 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_setup_data(bounds)
; } static void prv_setup_even_inner(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = window_layer->bounds; // Parameters outer_size = 50; inner_size = 35; angle_start = TRIG_MAX_ANGLE / 4; angle_end = TRIG_MAX_ANGLE; prv_setup_data(bounds); } static void prv_set...
MAX_MESSAGE_LEN, text_fmt, name_len, entry.name); dialog_set_text(dialog, text); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_LARGE); dialog_set_timeout(dialog, DIALOG_TIMEOUT_INFINITE /* no timeout */); // Any sort of application crash or window crash is a critical message as it // impacts the UX ex...
{ // There is no next app to launch? We're starting up, let's launch the startup app. app_install_release_md(s_next_app.md); s_next_app = (NextApp) { .md = system_app_state_machine_system_start(), }; }
} // Launch the new app if (!prv_app_start(s_next_app.md, s_next_app.common.args, s_next_app.common.reason)) { if (s_next_app.md->process_storage != ProcessStorageFlash) { PBL_CROAK("Failed to start system app <%s>!", process_metadata_get_name(s_next_app.md)); } PBL_LOG(LOG_LEVEL_WARNING, "Fai...
dle_discovery_result = prv_contains_service_changed_characteristic(&s_connection, indication) ? Handled : Unhandled; } } // Tests /////////////////////////////////////////////////////////// void test_gatt_service_changed_client__initialize(void) { s_last_handle_discovery_result = Unknown; fake_gatt_init...
(TEST_GATT_CONNECTION_ID, true /* has_service_changed_characteristic */)
; const uint16_t att_handle = fake_gatt_gatt_profile_service_service_changed_att_handle(); const uint16_t handle_range[1] = { [0] = 0x1, }; const bool handled = gatt_service_changed_client_handle_indication(&s_connection, att_handle, (const uint8_t *) handle_ra...
st uint32_t SOME_UINT8_KEY = 0x88888888; static const uint32_t SOME_UINT16_KEY = 0x16161616; static const uint32_t SOME_UINT32_KEY = 0x32323232; static const uint32_t SOME_INT8_KEY = 0x11888888; static const uint32_t SOME_INT16_KEY = 0x11161616; static const uint32_t SOME_INT32_KEY = 0x11323232; void test_dict__calc_s...
dict_read_begin_from_buffer(&iter, buffer, final_size)
; uint8_t count = 0; bool data_found = false; bool string_found = false; bool uint8_found = false; bool uint16_found = false; bool uint32_found = false; bool int8_found = false; bool int16_found = false; bool int32_found = false; bool null_cstring_found = false; bool empty_cstring_found = false; ...
.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 = offset_sec, .num_values = ARRAY_LENGTH(values), .values = va...
(session_ref, rtc_get_time(), input.msrmt.num_types, &input.msrmt.values[i * values_per_samples])
; cl_assert(success); } // 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 ...
/* * 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_text(ctx, s_text_buffer, &s_font_info, GRect(-44, 0, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL)
_window.progress_bar; loading_layer_init(loading_layer, &loading_frame); progress_layer_set_foreground_color((ProgressLayer *)loading_layer, GColorBlack); const GColor progress_bg_color = PBL_IF_COLOR_ELSE(GColorDarkGray, GColorWhite); progress_layer_set_background_color((ProgressLayer *)loading_layer, progres...
(window, WINDOW_NAME("Voice Window"))
; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_mic_window_load, .unload = prv_mic_window_unload, .appear = prv_mic_window_appear, .disappear = prv_mic_window_disappear }); window_set_user_data(window, data); prv_window_push(window); } // External interface ///////////////...
ntry automatically if not written } } void wakeup_init(void) { struct prv_missed_events_s missed_events = { 0, NULL }; s_mutex = mutex_create(); event_service_init(PEBBLE_WAKEUP_EVENT, NULL, NULL); // Create single reusable timer for wakeup events s_current_timer_id = new_timer_create(); s_wakeup_stat...
DEFINE_SYSCALL(void, sys_wakeup_delete, WakeupId wakeup_id)
{ WakeupEntry entry = prv_wakeup_settings_get_entry(wakeup_id); // Only allow owner to delete its own wakeup events if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { if (wakeup_id == s_wakeup_state.current_wakeup_id && new_timer_scheduled(s_current_timer_id, NULL)) { new...
m_watch = true; item->header.parent_id = (Uuid)UUID_REMINDERS_DATA_SOURCE; timeline_add(item); // Tweak the item before adding the reminder item->header.parent_id = item->header.id; uuid_generate(&item->header.id); item->header.type = TimelineItemTypeReminder; item->header.layout = LayoutIdReminder; re...
(data->reminder_str, e->dictation.text)
; data->reminder_str[reminder_str_len] = '\0'; data->timestamp = e->dictation.timestamp; if (data->timestamp == 0) { // If the user didn't specify a time set it to be 1 hour from the current time, // rounded up to the nearest 15 min. // Ex: a reminder created at 10:08 AM with no specified...
////////////////////////////////////////////////////////////////// #define JERRY_CREATE_VALUE(value) \ ((jerry_value_t)EM_ASM_INT_V({ \ return __jerryRefs.ref((value)); \ })) jerry_value_t jerry_create_array(uint32_t size) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(new Array(...
{ return false; }
return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); return (name in obj); }, obj_val, prop_name_val); } bool jerry_has_own_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_object(obj_val) || !jerry_value_is_st...
iting for the handler to be called. This will end up rescheduling us for // the right time once that gets handled. } else { animation_legacy2_scheduler->timer_handle = app_timer_register(interval_ms, (AppTimerCallback) animation_legacy2_timer_callback, animation_legacy2_sche...
{ animation_legacy2_private_unschedule_all(AppTaskCtxIdxApp); }
bool animation_legacy2_is_scheduled(AnimationLegacy2 *animation) { AnimationLegacy2Scheduler *animation_legacy2_scheduler = get_current_scheduler(); return list_contains(animation_legacy2_scheduler->head, &animation->list_node); } static void animation_legacy2_private_run(AnimationLegacy2Scheduler *animation_leg...
/* * 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...
mutex_unlock(s_sprf_mutex)
; } static bool prv_buffer_empty(const uint8_t *buf, size_t num_bytes) { for (uint32_t i = 0; i < num_bytes; i++) { if (buf[i] != 0xFF) { return false; } } return true; } static uint32_t prv_current_page_flash_addr(void) { return SPRF_PAGE_FLASH_ADDR(s_valid_page_idx); } static SprfMagic prv_ge...
f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x1f, 0xe0, /* bytes 2928 - 2944 */ 0x1f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf8, /* bytes 2944 - 2960 */ 0xff, 0xff, 0x7f, 0xf8, 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0...
{ load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, true /* is_next */); fake_boot_bit_set(BOOT_BIT_NEW_SYSTEM_RESOURCES_AVAILABLE); resource_init(); }
/* * 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...
(action_dialog, dialog_name)
; actionable_dialog_set_action_bar_type(action_dialog, DialogActionBarCustom, action_bar); return confirmation_dialog; } Dialog *confirmation_dialog_get_dialog(ConfirmationDialog *confirmation_dialog) { if (confirmation_dialog == NULL) { return NULL; } return actionable_dialog_get_dialog(&confirmation_d...
num_subscribers > 0); --service->num_subscribers; service->subscribers[subscription->task] = NULL; if (service->remove_subscriber_callback != NULL) { service->remove_subscriber_callback(subscription->task); } } static void prv_event_service_subscribe(PebbleSubscriptionEvent *subscription) { EventService...
prv_steal_buffer(*buf_ptr, service, e)
; // FIXME arguments? } PebbleTask cur_task = pebble_task_get_current(); for (unsigned i = 0; i < NumPebbleTask; i++) { if (!prv_task_is_masked_out(e, i) && service->subscribers[i]) { if (i == cur_task) { // We will handle this inline, but that has to happen after we copy it into the queues ...
#include <stdlib.h> static Window *window; static TextLayer *s_text_layer_a; static TextLayer *s_text_layer_b; static Animation *s_animation; static int toggle; #define DURATION 1000 static void animation_started(Animation *animation, void *data) { text_layer_set_text(s_text_layer_a, "Started."); } static voi...
{ case BUTTON_ID_UP: animation_set_curve((Animation*) a, AnimationCurveEaseOut); animation_set_curve((Animation*) a_rev, AnimationCurveEaseOut); break; case BUTTON_ID_DOWN: animation_set_curve((Animation*) a, AnimationCurveEaseIn); animation_set_curve((Animation*) a_rev, Animation...
/* // Exmple animation parameters: // Duration defaults to 250 ms animation_set_duration(&prop_animation->animation, 1000); // Curve defaults to ease-in-out animation_set_curve(&prop_animation->animation, AnimationCurveEaseOut); // Delay defaults to 0 ms animation_set_delay(&prop_animation->...
zerStateCount; } } static void prv_reset_test(Recognizer *recognizer) { prv_store_recognizer_idx(recognizer, &s_recognizers_reset); } void test_recognizer_manager__handle_touch_event(void) { const int k_rec_count = 5; s_dummy_impl.handle_touch_event = prv_handle_touch_event_test; s_dummy_impl.reset = prv_re...
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Failed)
; cl_assert_equal_i(recognizers[3]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); // Only layer A recognizer's gesture receives touch events e.type = TouchEvent_PositionUpdate; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_...
ng.h" #include "kernel/util/delay.h" #include "util/math.h" #include "util/size.h" #include "kernel/util/sleep.h" #include <inttypes.h> #include <stdbool.h> #include <stdio.h> // Note: Before adding a new header, be sure you actually need it! The goal // is to keep the driver as unreliant on higher level constructs a...
if (scale_reg_val == BMI160_ACC_RANGE_2G) { return BMI160_SCALE_2G; } else if (scale_reg_val == BMI160_ACC_RANGE_4G) { return BMI160_SCALE_4G; } else if (scale_reg_val == BMI160_ACC_RANGE_8G) { return BMI160_SCALE_8G; } else if (scale_reg_val == BMI160_ACC_RANGE_16G) { return BMI160_SCALE_16G; }
WTF; return 0; } static void prv_set_accel_scale(Bmi160Scale scale) { uint8_t cfg_val; switch (scale) { case BMI160_SCALE_2G: cfg_val = BMI160_ACC_RANGE_2G; break; case BMI160_SCALE_4G: cfg_val = BMI160_ACC_RANGE_4G; break; case BMI160_SCALE_8G: cfg_val = BMI160_ACC_...
/* * 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...
{ ClickHandler handler = prv_get_handler(recognizer, handler_offset); if (handler) { void *context; if ((handler_offset == ClickHandlerOffsetRawUp || handler_offset == ClickHandlerOffsetRawDown) && recognizer->config.raw.context != NULL) { // The context for raw click events is ove...
else { return false; } } inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) { return (recognizer->config.click.repeat_interval_ms >= 30); } inline static bool prv_is_multi_click_enabled(ClickRecognizer *recognizer) { return (recognizer->config.multi_click.handler != NULL); } inl...
/* * 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 true; }
/* * 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...
sdl_app_event_loop()
; } void wtf(void) { printf(">>> WTF\n"); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_watch_app_prefs_db.settings_file, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE)
; if (rv != S_SUCCESS) { mutex_unlock_recursive(s_watch_app_prefs_db.mutex); } return rv; } static void prv_close_file_and_unlock_mutex(void) { settings_file_close(&s_watch_app_prefs_db.settings_file); mutex_unlock_recursive(s_watch_app_prefs_db.mutex); } // WatchAppPrefDB API //////////////////////////...
either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/normal/bluetooth/ble_hrm.h" #include "comm/ble/gap_le_connection.h" #include "services/common/hrm/hrm_manager_private.h" #include <bluetooth/hrm_service.h> #incl...
(s_connections)
; ++i) { if (s_connections[i] == conn) { return true; } } return false; } void gap_le_connection_for_each(GAPLEConnectionForEachCallback cb, void *data) { for (int i = 0; i < ARRAY_LENGTH(s_connections); ++i) { cb(s_connections[i], data); } } void launcher_task_add_callback(CallbackEventCall...
K)); } static GColor prv_get_bar_color(HealthGraphCard *graph_card, bool is_active, bool is_wide) { const GColor active_color = GColorWhite; const GColor inactive_wide_color = GColorDarkGray; const GColor inactive_thin_color = graph_card->inactive_color; return (is_active ? active_color : (is_wide ? inactive_w...
IS_WEEKDAY(graph_card->current_day)
? graph_card->stats.weekday.avg : graph_card->stats.weekend.avg; } int day_point = prv_get_day_point(graph_card, graph_card->selection); if (graph_card->selection == graph_card->current_day && day_point == 0) { // If today has no progress, use the info from la...
/* * 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...
(structured_glance)
; if (alarms_glance) { event_service_client_unsubscribe(&alarms_glance->alarm_clock_event_info); kino_reel_destroy(alarms_glance->icon); } app_free(alarms_glance); } static void prv_set_glance_icon(LauncherAppGlanceAlarms *alarms_glance, uint32_t new_icon_resource_id) { ...
_assert(NumModalPriorities > 0); window_stack_push(window_stacks[0], windows[0][0], false); // A discreet window just went on-screen // Test: Discreet windows have no compositor transition modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_E...
cl_assert(NumModalPriorities > 1)
; window_stack_push(window_stacks[1], windows[1][0], false); // An opaque top window is now below two transparent top windows // Test: An opaque top window below a transparent top window removes Transparent // i.e. A transparent top window above an opaque top window does not result in Transparent modal...
ize(void) { bonding_sync_init(); fake_spi_flash_init(0, 0x1000000); pfs_init(false); s_ble_bonding_change_add_count = 0; s_ble_bonding_change_update_count = 0; s_ble_bonding_change_delete_count = 0; s_analytics_ble_pairings_count = 0; fake_shared_prf_storage_reset_counts(); bt_persistent_storage_in...
cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out))
; cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out)); // Store another pairing SMPairingInfo pairing_2; memset(&pairing_2, 0x00, sizeof(pairing_2)); pairing_2 = (SMPairingInfo) { .irk = (SMIdentityResolvingKey) { .data = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x08,...
ate == RecognizerState_Cancelled) || (new_state == RecognizerState_Completed) || (new_state == RecognizerState_Updated)); break; case RecognizerState_Cancelled: case RecognizerState_Completed: case RecognizerState_Failed: PBL_ASSERTN(new_state == RecognizerSt...
recognizer_cancel(recognizer)
TH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OR...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // SW = 5 setup_test_aa_sw(&ctx...
p duration 7777, // Typical fall asleep time 8888, // Typical wakeup time }; static uint32_t s_hr_zone_data[] = { 1, // Version NOW, // Timestamp 3, // Number of zones 60, // Minutes in zone 1 30, // Minutes in zone 2 15, // M...
health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_hr_zone_data, sizeof(s_hr_zone_data))
, S_SUCCESS); cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_HR_ZONE_METRICS); // check typicals (not stored) int32_t val_out; cl_assert(!health_db_get_typical_value(ActivityMetricHeartRateZone1Minutes, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricHear...
apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions an...
window_stack_unlock_push(&s_modal_window_stacks[i].window_stack)
; } } bool modal_manager_get_enabled(void) { return s_modal_min_priority < ModalPriorityMax; } ClickManager *modal_manager_get_click_manager(void) { return &s_modal_window_click_manager; } static WindowStack *prv_find_window_stack(ModalContextFilterCallback callback, void *data) { for (ModalPriority idx = Nu...
Y_APPMESSAGE #define DBG(fmt, ...) PBL_LOG(LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__) #else #define DBG(fmt, ...) #endif #define DEBUG_VERBOSE_ROCKY_APPMESSAGE 1 #if DEBUG_VERBOSE_ROCKY_APPMESSAGE #define DBG_VERBOSE(fmt, ...) PBL_LOG(LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__) #else #define DBG_VERBOSE(fmt, ...) #endif #defin...
if (s_state.state == PostMessageStateDisconnected) { // Handle the race. See comment in prv_init_apis(). return; }
DBG("Transport Disconnected"); const bool did_exit_session_open = (s_state.state == PostMessageStateSessionOpen); s_state.state = PostMessageStateDisconnected; if (did_exit_session_open) { prv_session_open__after_exit(); } } static void prv_handle_comm_session_event(PebbleEvent *e, void *unused) { Peb...
id event_uuids[10]; static ActivitySession event_sessions[10]; s_parsed_msg = (TestPLParsedMsg) { .events = { .num_events = ARRAY_LENGTH(events), .events = events, .uuids = event_uuids, .num_sessions = ARRAY_LENGTH(event_sessions), .sessions = event_sessions, }, }; // Get...
cl_assert_equal_i(a->events.num_events, b->events.num_events)
; cl_assert_equal_i(a->events.num_sessions, b->events.num_sessions); for (int i = 0; i < a->events.num_events; i++) { const pebble_pipeline_Event *a_event = &a->events.events[i]; const pebble_pipeline_Event *b_event = &b->events.events[i]; cl_assert_equal_i(a_event->type, b_event->type); ...
nvalid stream // error and set the pointer to the stream to be null cl_assert_equal_i(utf8_peek_codepoint(malformed_test_string_utf8, NULL), 0); cl_assert_(*malformed_test_string_utf8 == 0xcd, "Failed to invalidate an invalid UTF-8 test string"); } void test_utf8__decode_all_gothic_codepoints(void) { static co...
realloc(output_buffer, 4)
; trunc_size = utf8_truncate_with_ellipsis("Hello", output_buffer, 4); cl_assert_equal_s(output_buffer, "\xe2\x80\xa6"); cl_assert_equal_i(trunc_size, 4); // test where max_length == ellipsis_length + 1 output_buffer = realloc(output_buffer, 5); trunc_size = utf8_truncate_with_ellipsis("Hello", output_buff...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_message_outbox_size_maximum()
; if (size_outbound > size_maximum) { // Truncate if it's more than the max: size_outbound = size_maximum; } else if (size_outbound == size_maximum) { APP_LOG(LOG_LEVEL_INFO, "app_message_open() called with app_message_outbox_size_maximum()."); APP_LOG(LOG_LEVEL_INFO, "This consumes %"PR...
/* * 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...
periph_config_enable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK)
; } static void prv_disable_display_spi_clock() { periph_config_disable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK); } static void prv_enable_chip_select(void) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); // required setup time > 3us delay_us(7); } static void prv_disable_chip_select(void) { // delay ...
rts_get_mask() == AlertMaskAllOn); // Should not allow any notifications through alerts_set_mask(AlertMaskAllOff); cl_assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_sh...
(AlertReminder)
); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_no...
/* * 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...
(system_flash_base + i, buffer, chunk_size, NULL, NULL)
) { dbgserial_putstr("We're dead"); return false; } prv_display_write_progress(i, firmware_length, NULL); } return true; } static bool prv_check_firmware_crc(FirmwareDescription* firmware_description) { dbgserial_print("Checksumming "); dbgserial_print_hex(firmware_description->firmware_len...
EOUT_MS; if ((rtc_get_ticks() - connection->ticks_since_connection) < REQUIRED_INIT_PAUSE_TICKS) { retry_ms = (REQUIRED_INIT_PAUSE_S * MS_PER_SECOND); goto retry; } // Fall-back: uint16_t actual_connection_interval_ms = prv_params_for_state(connection, ResponseTimeMax)->connection_interval_max_1_...
(connection, desired_state)
; // If the timer callback is executing (waiting on bt_lock) at this point, it's not a problem // because the actual vs desired state gets checked in the timer callback path as well. new_timer_stop(connection->param_update_info.watchdog_timer); return; } // Connection parameters are updated, but t...
1, 3}; void test_timeline_model__future(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_...
timeline_model_get_iter_state(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...
for (int i=0; i < 64; i++) { prv_test_plot_horizontal_line(&ctx.dest_bitmap, GRect(OFFSET_X, OFFSET_Y + i, STRIPE_WIDTH, STRIPE_HEIGHT), (GColor){.argb = color | alpha}); color++; }
// 100% alpha channel blend test color = 0x0; alpha = 0xC0; for (int i=64; i < 128; i++) { prv_test_plot_horizontal_line(&ctx.dest_bitmap, GRect(OFFSET_X, OFFSET_Y + i, STRIPE_WIDTH, STRIPE_HEIGHT), (GColor){.argb = color | alpha}); ...
s array (): rocky_api_graphics_path2d_reset_state(); // some tests deinitialize the engine, avoid double de-init if (app_state_get_rocky_runtime_context() != NULL) { jerry_cleanup(); rocky_runtime_context_deinit(); } fake_pbl_malloc_check_net_allocs(); } static const RockyGlobalAPI *s_graphics_api[...
EXECUTE_SCRIPT( "ctx.lineTo(11.5, 12.7);\n" "ctx.fill();\n" )
; // still only the first part (before the .moveTo()) as the second only has two points cl_assert_equal_i(2, s_gpath_draw_filled.call_count); cl_assert_equal_i(3, lc->path.num_points); cl_assert_equal_point(GPoint(6, 7), lc->path.points[0]); cl_assert_equal_point(GPoint(8, 9), lc->path.points[1]); cl_assert...
/* * 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_send_command_arg(scene)
; prv_end_command(); } void prv_set_parameter(uint32_t param) { prv_start_command(CMD_SET_PARAMETER); // Send in little-endian byte order prv_send_command_arg(param & 0xff); prv_send_command_arg((param >> 8) & 0xff); prv_send_command_arg((param >> 16) & 0xff); prv_send_command_arg((param >> 24) & 0xff); ...
)); *test_reel_impl = (KinoReelImpl) { .destructor = prv_destructor, .set_elapsed = prv_elapsed_setter, .get_elapsed = prv_elapsed_getter, .get_duration = prv_duration_getter }; test_reel = kino_reel_custom_create(test_reel_impl, test_reel_data); cl_assert(test_reel != NULL); test_player = m...
animation_is_scheduled(animation)
, false); animation_schedule(animation); animation_set_elapsed(animation, 20); animation_set_duration(animation, 300); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__infinite_animation_finite_reel_forwar...
test with high amplitude in the negative direction prv_write_reg(BMI160_REG_SELF_TEST, 0x8 | 0b01); psleep(50); struct { char axis_name; uint8_t register_address; int pass_threshold; int16_t negative_value; int16_t positive_value; } accel_test_axis[] = { { .axis_name = 'X', ...
(BMI160_REG_PMU_STATUS)
>> 2; if (status == mode) { break; } psleep(5); BMI160_DBG("GYRO: want mode %d, actual %d", mode, status); } PBL_ASSERT(retries > 0, "Gyro: Could not set power mode to %d", mode); s_gyro_power_mode = mode; BMI160_DBG("PMU_STATUS: 0x%x", bmi160_read_reg(BMI160_REG_PMU_STATUS)); } /* * a...
*)pattern_attribute->data; } static unsigned int prv_vibe_score_get_num_note_types(GenericAttribute *notes_attribute) { return notes_attribute->length / sizeof(VibeNote); } static unsigned int prv_vibe_score_get_pattern_length(GenericAttribute *pattern_attribute) { return pattern_attribute->length / sizeof(VibeN...
{ uint32_t data_size; if (!prv_vibe_score_resource_is_valid(app_num, resource_id, VIBE_SIGNATURE, &data_size)) { return NULL; } VibeScore *vibe_score = applib_zalloc(data_size); if (!vibe_score || sys_resource_load_range(app_num, resource_id, VIBE_DATA_OFFSET, ...
/* * 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...
("pebble_time_white")
; break; case WATCH_INFO_COLOR_TIME_BLACK: model_name = SNOWY_MODEL("pebble_time_black"); break; case WATCH_INFO_COLOR_TIME_RED: model_name = SNOWY_MODEL("pebble_time_red"); break; case WATCH_INFO_COLOR_TIME_STEEL_SILVER: model_name = SNOWY_MODEL("pebble...
(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_top_left.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_top_right.${BIT_DEPTH_NAME}...
/* * 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...
(result, prv_legacy_f4_calculation_millivolts(reading))
; }
calories = 400, .distance_meters = 500, }, }; activity_sessions_prv_add_activity_session(&old_activity); activity_sessions_prv_add_activity_session(&new_activity); ASSERT_NUM_ACTIVITY_SESSIONS(4); // 2 sleep sessions + 2 activity sessions ASSERT_STEP_ACTIVITY_SESSION_PRESENT(&old_activity); ASSER...
(ActivityMetricStepCount, 1, &value)
; cl_assert_equal_i(value, k_exp_steps); cl_assert_equal_i(health_service_sum_today(HealthMetricStepCount), k_exp_steps); activity_get_metric(ActivityMetricActiveSeconds, 1, &value); cl_assert_equal_i(value, SECONDS_PER_HOUR); cl_assert_equal_i(health_service_sum_today(HealthMetricActiveSeconds), SECONDS_PER...
, GPoint(10, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 76), 5); // T facing right - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(45, 75), 5); // T facing right - odd vert, even horiz graphics_draw_...
GPoint(131, 71)
, 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(132, 76), 5); // T facing right - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(10, 96), 5); // T facing right - even vert, even horiz graphics_draw_vertical_line_dotted(&ct...
{ 0, 0x3b, 1217, 146, 0}, { 0, 0x6a, 59, 146, 0}, { 0, 0x69, 0, 145, 0}, { 0, 0x69, 0, 146, 0}, { 0, 0x69, 0, 146, 0}, { 0, 0x69, 0, 146, 0}, { 0, 0x2e, 502, 146, 0}, { 0, 0x2e, 0, 145, 0}, { 0, 0x2e, 0, 146, 0}, { 0, 0x2e, 290, 146, 0}, { 0, 0x2, 755, 146, 0}, { 0, 0x25, 0, ...
ARRAY_LENGTH(samples)
; return samples; }
line_pattern_record_assign_vertical_line); CHECK_EXPECTED_TEST_IMAGE(s_ctx); }; void prv_mask_recording_blend_vertical_line_raw(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color); void test_graphics_context_mask__record_blend_vertical_line_raw(void) { p...
CHECK_EXPECTED_TEST_IMAGE(s_ctx)
; }; ////////////////////////////////// // APPLYING VERTICAL LINE TESTS // ////////////////////////////////// // These tests initialize a mask that has 4 * 64 rows, each of height // `vline_applying_test_row_height`. Each quad grouping of these rows in the mask is initialized to // have one of the 4 possible mask val...
// It should get immediate air-time for one cycle: cl_assert(infinite_job_d); assert_ad_data("D"); // Round-robin 4 times: for (int i = 0; i < 4; ++i) { regular_timer_fire_seconds(1); assert_ad_data("A"); regular_timer_fire_seconds(1); assert_ad_data("B"); regular_timer_fire_seconds(1); ...
gap_le_is_advertising_enabled()
, true); assert_ad_data("B"); } void test_gap_le_advert__round_robin_two_jobs_incl_silent_terms(void) { GAPLEAdvertisingJobTerm advert_terms_a[] = { { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 1, }, { .min_interval_slots = 480, .max_interval_...
_t slave_latency_events; uint32_t supervision_to_ms; int num_samps; } LeConnectionParams; static LeConnectionParams s_le_conn_params = { 0 }; void bluetooth_analytics_get_param_averages(uint16_t *params) { int num_samps = s_le_conn_params.num_samps; if (num_samps != 0) { params[0] = s_le_conn_params.slave...
PBL_LOG(LOG_LEVEL_DEBUG, "Link quality: %x, RSSI: %d", link_quality, rssi)
/* * 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...
(us_pacific_region, america_los_angeles_region)
; const int america_new_york_region = FIND_REGION("America/New_York"); cl_assert(america_new_york_region != -1); cl_assert(america_new_york_region != america_los_angeles_region); } void test_timezone_database__load_region_name(void) { const char america_los_angeles_region_name[] = "America/Los_Angeles"; co...
omes the active layer. The // child is reset. All recognizers remain in the possible state. s_active_layer = &layer_c; e.type = TouchEvent_Touchdown; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled); prv_compare_recognize...
(&manager, r1)
; cl_assert_equal_p(manager.triggered, r2); cl_assert_equal_p(manager.active_layer, &layer_a); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(r2->state, RecognizerState_Started); cl_assert(!recognizer_get_manager(r1)); } void test_recognizer_manager__handle_s...
{ layer_init(layers[i], &GRectZero); }
layer_add_child(&parent, &child_a); cl_assert(layer_is_descendant(&child_a, &parent)); cl_assert(!layer_is_descendant(&parent, &child_a)); cl_assert(!layer_is_descendant(&child_b, &parent)); layer_add_child(&parent, &child_b); cl_assert(layer_is_descendant(&child_b, &parent)); cl_assert(!layer_is_desce...
-1480, 200, 24}, { -1280, 296, 56}, { -1240, 360, 64}, { -1280, 336, 96}, // 28 seconds { -1208, 312, 56}, { -1112, 288, 88}, { -1168, 496, -32}, { -1128, 824, -8}, { -1200, 584, -184}, { -1208, 560, -296}, { -1160, 432, -384}, { -1264, 416, -400}, { -1560, 304, -200...
{ -1536, 88, -128}, { -1464, 104, -264}, { -1368, 392, -416}, { -1104, 440, 72}, { -904, 376, -144}, { -944, 384, -128}, { -968, 248, -16}, { -872, 304, 16}, { -992, 312, 0}, { -1192, 376, 72}, { -1240, 656, 120}, { -1240, 424, -136}, { -1024, 512, -104}, { -1408,...
{ -1168, 528, 56}, // 36 seconds { -920, 536, -56}, { -1104, 272, -8}, { -1648, 368, -24}, { -1856, 344, 32}, { -2024, 272, 72}, { -1856, 192, 104}, { -1696, 136, 96}, { -1568, 112, 168}, { -1336, 80, 144}, { -1136, 120, 128}, { -1056, 56, 96}, { -984, -112, 184}...
sts] = result; num_tests++; if (num_tests >= k_max_tests) { printf("RAN INTO MAX NUMBER OF TESTS WE SUPPORT"); break; } } // Make sure we discovered at least 1 test cl_assert(num_tests > 0); // Let's sort the tests by name qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_q...
rtc_get_time()
; time_t test_start_utc = now; for (int i = 0; i < entry->num_samples; i++) { const bool shutting_down = (entry->force_shut_down_at == i); kalg_activities_update(s_kalg_state, now, entry->samples[i].v5_fields.steps, 0 /*vmc*/, 0 /*orientation*/, false /*plugged_in*/, 0 /...
}, { 832, 264, -512}, { 832, 264, -504}, { 832, 264, -496}, { 840, 264, -496}, { 832, 264, -496}, { 832, 264, -496}, { 840, 272, -504}, { 832, 272, -512}, { 832, 272, -496}, { 832, 272, -504}, { 832, 280, -512}, { 832, 280, -504}, { 832, 280, -496}, // 149 seconds...
{ 600, 632, -688}, { 368, 752, -552}, { 368, 824, -576}, { 344, 704, -488}, { 320, 560, -392}, { 328, 592, -256}, { 360, 592, -16}, { 344, 1072, -40}, { 384, 928, 392}, { 296, 952, 456}, { 216, 872, 480}, { 144, 704, 608}, { 208, 752, 552}, { 200, 616, 672}, {...
*read = (const Read) { .characteristic = characteristic, .client = client, }; if (s_read_head) { list_append((ListNode *)s_read_head, &read->node); } else { s_read_head = read; } return BTErrnoOK; } void gatt_client_consume_read_response(uintptr_t object_ref, ...
(old_head)
ss = buffer_address + length; const uintptr_t last_address_aligned = last_address & (~word_mask); const uintptr_t start_address_aligned = ((buffer_address + word_mask) & (~word_mask)); uint32_t leading_bytes = start_address_aligned - buffer_address; uint32_t trailing_bytes = last_address - last_address_aligne...
while (QSPI_GetFlagStatus(QSPI_FLAG_SM) == RESET) { if ((timeout_us != QSPI_NO_TIMEOUT) && (++loops > timeout_us)) { PBL_LOG(LOG_LEVEL_ERROR, "Timeout waiting for a bit!?!?"); return false; } delay_us(1); }
/* * 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...
jerry_create_error(JERRY_ERROR_TYPE, (jerry_char_t *)msg)
tic void prv_draw_text_node(GTextNode *node, GContext *ctx, const GRect *box, const GTextNodeDrawConfig *config, bool render, GSize *size_out); static bool prv_container_each(GTextNodeContainer *container_node, ContainerIterCallback callback, void *context)...
if (prev_child) { prev_child->sibling = child; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_message_sender_init()
_invoke_pending(); after_size = app_cache_get_size(); cl_assert_equal_i(after_size, (before_size - to_free)); // test removing all binaries prv_cleanup(); to_free = SIZE_SUM; before_size = app_cache_get_size(); cl_assert(before_size >= to_free); cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_f...
app_file_name_make(filename, size, id, APP_FILE_NAME_SUFFIX, strlen(APP_FILE_NAME_SUFFIX))
; } static void prv_res_filename(char *filename, size_t size, int id) { app_file_name_make(filename, size, id, APP_RESOURCES_FILENAME_SUFFIX, strlen(APP_RESOURCES_FILENAME_SUFFIX)); } // create app and res files (and add to the app cache) static void prv_app_files_create(int id) { char filena...
r (int i = 0; i < s_command_list_index; ++i) { cl_assert_equal_i(s_command_list[i].addr, commands[i].addr); cl_assert_equal_i(s_command_list[i].type, commands[i].type); } } static int s_dummy_value = 42; static int *s_callback_ctx = &s_dummy_value; static void prv_callback(void *context, status_t status) { ...
prv_test_erase_optimal_range( 0, 0, 69 * 1024, 96 * 1024, (EraseCommand[]) { { 0, SectorEraseCommand }, { 64 * 1024, SubsectorEraseCommand }, { 68 * 1024, SubsectorEraseCommand }, { }, })
; } void test_flash_erase__96k_app_banks_3(void) { // App that's in an unaligned bank but smaller than 64k prv_test_erase_optimal_range( 32 * 1024, 32 * 1024, (32 + 18) * 1024, (32 + 96) * 1024, (EraseCommand[]) { { 32 * 1024, SubsectorEraseCommand }, { 36 * 1024, SubsectorEraseComm...
/* * 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...
number_window_init(&data->num, "Some Number", (NumberWindowCallbacks) { .selected = selected }, data)
; number_window_set_min(&data->num, 10); number_window_set_max(&data->num, 100); number_window_set_step_size(&data->num, 5); const bool animated = true; app_window_stack_push(&data->num.window, animated); } static void handle_deinit(void) { AppData *data = app_state_get_user_data(); app_free(data); } ...
zer) { recognizer->is_button_down = true; prv_cancel_timer(&recognizer->multi_click_timer); const bool needs_reset = false; prv_dispatch_event(recognizer, ClickHandlerOffsetRawDown, needs_reset); if (prv_is_long_click_enabled(recognizer)) { const uint32_t long_click_delay = prv_long_click_get_delay(rec...
{ for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { prv_click_reset(&click_manager->recognizers[button_id]); click_manager->recognizers[button_id].config = (ClickConfig){}; } }
void click_manager_reset(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < NUM_BUTTONS; button_id++) { prv_click_reset(&click_manager->recognizers[button_id]); } }