prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_blend_horizontal_line_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_blend_horizontal_line_raw"))); }; void prv_assign_horizontal_line_delta_raw(GBitma...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_blend_vertical_line_raw"))
ia. #define MULTIMEDIA_INDICATOR_LENGTH 64 #define MULTIMEDIA_EMOJI "🎁" // AttributeIdTitle + AttributeIdAncsAction. See prv_fill_native_ancs_action static const int NUM_NATIVE_ANCS_ACTION_ATTRS = 2; static const char s_utf8_ellipsis[] = UTF8_ELLIPSIS_STRING; static int prv_add_ellipsis(char *buffer, int length) { ...
snprintf(buffer, length, "%s%s", i18n_get("sent an attachment", __FILE__), emoji_str)
; } //! @param buffer Pointer to a buffer large enough to hold all attribute strings required by //! the action. If buffer points to null, a new buffer will be allocated //! @return Pointer to the end of the buffer (*buffer + size of strings) static uint8_t *prv_fill_native_ancs_action(uint8_t **buffer, ...
layer_get_unobstructed_bounds(const Layer *layer, GRect *bounds_out) { *bounds_out = layer->bounds; } GFont fonts_get_system_font(const char *font_key) { return (GFont)123; } void graphics_draw_text(GContext *ctx, const char *text, GFont const font, const GRect box, const GTextOverflowMod...
prv_deinit()
; char *script = "function f(i) { return i * 4; } f(5);"; bool result = rocky_event_loop_with_string_or_snapshot(script, strlen(script)); cl_assert(result); } static bool s_tictoc_callback_is_color; static void prv_rocky_tictoc_callback(void) { Layer *root_layer = &s_app_window_stack_get_top_window.layer; ro...
= true, }, #endif }; #define COMPOSITE_TEST_IMAGE_SIZE_WIDTH (100) #define COMPOSITE_TEST_OFFSET_X (COMPOSITE_TEST_IMAGE_SIZE_WIDTH / 2) #define COMPOSITE_TEST_OFFSET_Y (0) static bool prv_gbitmap_format_and_compositing_mode_combo_is_valid(GBitmapFormat bitmap_format, ...
GPoint(0, 40)
.num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { .id = {0x02}, .parent_id = {0}, .timestamp = 1421107200, // Tue Jan 13 midnight 2015 UTC .durat...
(!iter_next(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); cl_assert(state.node); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); } void test_timeline__forward_and_back(void) { Iterator iterator = {0}; TimelineIterState state = {0}; Timelin...
/* * 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...
{ CLEAR_BIT(RCC->AHB1ENR, (0x1 << idx)); }
} void gpio_output_init(OutputConfig pin_config, GPIOOType_TypeDef otype, GPIOSpeed_TypeDef speed) { GPIO_InitTypeDef init = { .GPIO_Pin = pin_config.gpio_pin, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = speed, .GPIO_OType = otype, .GPIO_PuPd = GPIO_PuPd_NOPULL }; gpio_u...
/* * 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_delta_moook_out)
* ANIMATION_TARGET_FRAME_INTERVAL_MS; } uint32_t interpolate_moook_duration() { return interpolate_moook_in_duration() + interpolate_moook_out_duration(); } uint32_t interpolate_moook_soft_duration(int32_t num_frames_mid) { return interpolate_moook_duration() + num_frames_mid * ANIMATION_TARGET_FRAME_INTERVAL_MS...
uint32_t start_addr, uint32_t buffer_size) { memcpy(buffer, (void*)(FMC_BANK_1_BASE_ADDRESS + start_addr), buffer_size); } static void flash_s29vs_software_reset(void) { flash_s29vs_issue_command(0, S29VSCommand_SoftwareReset); } void flash_init(void) { gpio_use(GPIOB); gpio_use(GPIOD); gpio_use(GPIOE); ...
(&nor_init)
; // Re-enable NOR FMC_NORSRAMCmd(FMC_Bank1_NORSRAM1, ENABLE); } bool flash_sanity_check(void) { // Check that the first words of the CFI table are 'Q' 'R' 'Y'. // This will work on any flash memory, regardless of the manufacturer. flash_s29vs_issue_command(0, S29VSCommand_CFIEntry); bool ok = (flash_s29v...
_sharing(connection)) { *ctx->next_permitted_device = connection->device; ++ctx->next_permitted_device; --ctx->slots_left; } } static size_t prv_copy_sharing_devices(BTDeviceInternal *devices_out, size_t max_devices) { bt_lock(); CopySharingDevicesCtx ctx = { ...
(prv_push_reminder_popup_kernel_main_cb)
include <util/net.h> #include "FreeRTOS.h" #include "semphr.h" #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> //! Modulus for sequence numbers #define MODULUS (128u) #define MAX_RETRANSMITS (10) #define RETRANSMIT_TIMEOUT_MS (200) // Reliable Transport protocol // ================...
if (!s_layer_up) { return; }
if (length < sizeof((ReliablePacket){0}.s)) { PBL_LOG(LOG_LEVEL_DEBUG, "Received malformed command packet"); prv_bounce_ncp_state(); return; } ReliablePacket *packet = raw_packet; if (packet->is_supervisory) { if (packet->s.kind != SupervisoryKind_ReceiveReady && packet->s.kind != Sup...
848, -136}, { 1352, 784, -192}, { 1704, 728, -168}, { 1760, 568, 0}, { 1464, 472, -120}, { 1112, 368, -152}, { 920, 264, -64}, { 848, 200, -80}, { 776, 168, -80}, { 776, 144, -88}, { 744, 80, -72}, { 792, -8, -56}, { 736, -32, -8}, { 952, 80, -24}, // 24 seconds ...
{ 1296, 424, -96}, { 1064, 344, -104}, { 928, 288, -96}, { 856, 224, -80}, { 768, 184, -64}, { 664, 136, -64}, { 704, 112, -64}, { 872, 32, -72}, { 1136, -24, -40}, { 1512, 104, 8}, { 1368, 272, -176}, { 1504, 304, -240}, { 1512, 272, -80}, { 1272, 344, -168}, ...
{ 1344, 448, -256}, { 1088, 496, -320}, { 944, 528, -152}, { 920, 624, -248}, { 832, 624, -304}, { 928, 704, -432}, // 32 seconds { 880, 648, -344}, { 864, 744, -368}, { 904, 696, -248}, { 1256, 640, -168}, { 1216, 696, -256}, { 1504, 672, -168}, { 1712, 576, 0},...
ef struct AllRegisters { // DCDC uint16_t DCDC_CTRL_0_REG; uint16_t DCDC_CTRL_1_REG; uint16_t DCDC_CTRL_2_REG; uint16_t DCDC_V14_0_REG; uint16_t DCDC_V14_1_REG; uint16_t DCDC_V18_0_REG; uint16_t DCDC_V18_1_REG; uint16_t DCDC_VDD_0_REG; uint16_t DCDC_VDD_1_REG; uint16_t DCDC_V18P_0_REG; uint16_t ...
(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_TRIG, 0x8)
; REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_RES, 0x8); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TUNE, 0x0); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_LSSUP_TRIM, 0x5); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_HSGND_TRIM, 0x5); REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_V14_0_...
op(this->state->restart_timer); } static void prv_transition_to(PPPControlProtocol *this, enum LinkState nextstate) { if (nextstate == LinkState_Initial || nextstate == LinkState_Starting || nextstate == LinkState_Closed || nextstate == LinkState_Stopped || nexts...
MIN(ntoh16(bad_packet->length), pulse_link_max_send_size() - LCP_HEADER_LEN)
; memcpy(packet->data, bad_packet, body_len); pulse_link_send(packet, LCP_HEADER_LEN + body_len); } static void prv_on_timeout(void *context) { PPPControlProtocol *this = context; mutex_lock(this->state->lock); if (this->state->restart_count > 0) { // TO+ switch (this->state->link_state) { case Li...
/* * 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_create_window_and_render(ActivitySessionType_Walk); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
void test_workout_summary__render_run(void) { prv_create_window_and_render(ActivitySessionType_Run); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
nsor_start_ticks = 0; return false; } return true; } // Start the tick counter if this is the first reading since power-on or off-wrist if (s_manager_state.sensor_start_ticks == 0) { s_manager_state.sensor_start_ticks = rtc_get_ticks(); } // When first powering up, we can get "Excellent" q...
( ACCEL_SAMPLING_25HZ, prv_handle_accel_data, NULL, PebbleTask_NewTimers)
; accel_manager_set_jitterfree_sampling_rate(s_manager_state.accel_state, HRM_MANAGER_ACCEL_RATE_MILLIHZ); sys_accel_manager_set_sample_buffer( s_manager_state.accel_state, s_manager_state.accel_manager_buffer, HRM_MANAGER_ACCEL_MANAGER_SA...
/* * 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...
(MFG_COLOR_KEY)
&& memcmp(data + 2, MFG_COLOR_KEY, strlen(MFG_COLOR_KEY)) == 0) { prv_send_color_response(); return; } prv_send_fail_response(); }
/* * 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...
event_cleanup(&event)
; return; } event_service_client_handle_event(&event); prv_handle_event(&event); event_cleanup(&event); } } // ------------------------------------------------------------------------------------------------- void worker_launch_app(void) { sys_launch_app_for_worker(); }
lock_ctrl, DISABLE); } void i2c_hal_init(I2CBus *bus) { NVIC_SetPriority(bus->hal->ev_irq_channel, I2C_IRQ_PRIORITY); NVIC_SetPriority(bus->hal->er_irq_channel, I2C_IRQ_PRIORITY); NVIC_EnableIRQ(bus->hal->ev_irq_channel); NVIC_EnableIRQ(bus->hal->er_irq_channel); prv_i2c_deinit(bus); } static void prv_i2c_i...
{ transfer->state = I2CTransferState_ReadData; }
else { transfer->state = I2CTransferState_WriteData; } } } static void prv_enable_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 |= I2C_CR1_ERRIE | // Enable error interrupt I2C_CR1_NACKIE | // Enable NACK interrupt I2C_CR1_TCIE | // Enable transfer complet...
t_new = t1 * t2 void gtransform_concat(GTransform *t_new, const GTransform *t1, const GTransform * t2) { if ((!t_new) || (!t1) || (!t2)) { return; } Fixed_S32_16 a_a = Fixed_S32_16_mul(t1->a, t2->a); Fixed_S32_16 b_c = Fixed_S32_16_mul(t1->b, t2->c); Fixed_S32_16 a_b = Fixed_S32_16_mul(t1->a, t2->b); ...
Fixed_S16_3_add3(x_a, y_c, one_tx)
; Fixed_S16_3 sum_y = Fixed_S16_3_add3(x_b, y_d, one_ty); return GVectorPrecise(sum_x.raw_value, sum_y.raw_value); }
E_ID_SYSTEM_CE_MARK); gbitmap_init_with_resource(&cd->weee_mark, RESOURCE_ID_SYSTEM_WEEE_MARK); gbitmap_init_with_resource(&cd->r_mark, RESOURCE_ID_SYSTEM_R_MARK); gbitmap_init_with_resource(&cd->t_mark, RESOURCE_ID_SYSTEM_T_MARK); gbitmap_init_with_resource( &cd->aus_rcm_mark, RESOURCE_ID_SYSTEM_AUS_RCM_...
gbitmap_deinit(&data->certification_data.t_mark)
; gbitmap_deinit(&data->certification_data.aus_rcm_mark); gbitmap_deinit(&data->certification_data.nom_nyce_mark); app_free(data->certification_data.regulatory_marks); app_free(data->certification_data.menu_items); prv_deinit_status_bar(&data->status_layer); } static void prv_certification_window_push(Sett...
/* * 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...
EM_ASM_INT_V({ abort(); })
; while (1); } void passert_failed_hashed(uint32_t packed_loghash, ...) { EM_ASM_INT_V({ abort(); }); while (1); } void pbl_log(uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, ...) { printf("%s:%d ", src_filename, src_line_number); va_list args; va_start(arg...
(1); #endif reset_due_to_software_failure(); } return should_context_switch; } static bool prv_try_event_put(QueueHandle_t queue, PebbleEvent *event) { PBL_ASSERTN(queue); return (xQueueSendToBack(queue, event, milliseconds_to_ticks(3000)) == pdTRUE); } static void prv_event_put(QueueHandle_t queue, ...
(s_from_worker_event_queue, event, 0)
; } // If there was nothing in the queue, return false. We are misusing the queue set by pulling events out // from the s_kernel_event_queue queue before it's activated so likely, the activated queue was // s_kernel_event_queue. if (!result) { return false; } } s_current_event = pr...
top_metric, middle_metric, ARRAY_LENGTH(scrollable_metrics), scrollable_metrics, &s_sports_data, &s_sports_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_speed(void) { s_sports_data = (SportsData) ...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_workout_active__sports_hr_z3(void) { s_sports_data = (SportsData) { .current_bpm = 180, .duration_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", }; WorkoutMetricType top_metric = WorkoutMetricType_Duration; WorkoutMetricType middle_metric = WorkoutMetricType_D...
ions[1] = (ActivitySession){ .type = ActivitySessionType_Sleep, .start_utc = now - (20 * SECONDS_PER_MINUTE), .length_min = 10, // end = -10 }; s_sys_activity_get_sessions_values.out.sessions[0] = (ActivitySession){ .type = ActivitySessionType_RestfulSleep, .start_utc = now - (18 * SECONDS_PER_M...
(s_prv_activity_cb__args[0].time_start, s_sys_activity_get_sessions_values.out.sessions[6].start_utc)
; cl_assert_equal_i(s_prv_activity_cb__args[6].time_start, s_sys_activity_get_sessions_values.out.sessions[0].start_utc); } void test_health__peek_current_activities(void) { HealthActivityMask activities; activities = health_service_peek_current_activities(); cl_assert_equal_i(activities, H...
_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORI...
pliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either...
(s_valid_session)
; } // Check for leaks: fake_kernel_malloc_mark_assert_equal(); fake_kernel_malloc_deinit(); } void test_session_send_queue__get_length_returns_summed_length_of_all_jobs(void) { cl_assert_equal_i(0, comm_session_send_queue_get_length(s_valid_session)); int num_jobs = 3; for (int i = 0; i < num_jobs; ++...
or flash_erase_sector_blocking(TEST_ADDR); if (!flash_sector_is_erased(TEST_ADDR)) { prompt_send_response("FAIL: sector not erased"); return; } // write data into the sector const uint32_t BUFFER_SIZE = 256; uint8_t buffer[BUFFER_SIZE]; for (uint32_t i = 0; i < BUFFER_SIZE; i++) { buffer[i] =...
prv_is_really_erased(sub_addr, true)
; prompt_send_response_fmt(buffer, sizeof(buffer), " SUBSECTOR - 0X%-6"PRIx32" :: %s", sub_addr, sub_erased ? "true" : "false"); } } addr += SECTOR_SIZE_BYTES; task_watchdog_bit_set(pebble_task_get_current()); } } /* * Commented out by default because this...
or code size savings. static NOINLINE void prv_enable_display_access(void) { prv_enable_display_spi_clock(); prv_enable_chip_select(); } static NOINLINE void prv_disable_display_access(void) { prv_disable_chip_select(); prv_disable_display_spi_clock(); } //! Write a single byte synchronously to the display. T...
SPI_Cmd(DISP_SPI, ENABLE)
, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_aa_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Remove these #ifdefs in PBL-15916 when support fo...
GSize(5, 10)
, GCornersAll, 4), 2); cl_assert_equal_i(prv_clamp_corner_radius(GSize(6, 10), GCornersAll, 4), 3); cl_assert_equal_i(prv_clamp_corner_radius(GSize(7, 10), GCornersAll, 4), 3); cl_assert_equal_i(prv_clamp_corner_radius(GSize(8, 10), GCornersAll, 4), 4); cl_assert_equal_i(prv_clamp_corner_radius(GSize(9, 10), GC...
and d completed cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_ha...
(b, delay_b)
; animation_set_play_count(b, play_count_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); animation_set_delay(seq, delay_seq); animation_set_play_count(seq, play_count_seq); // Check durations cl_assert_equal_i(animation_get_duration(a, false, f...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
heap->lock_impl.lock_function(heap->lock_impl.lock_context)
; } } //! Unlock the heap, using whatever behaviour the heap has configured using heap_set_lock_impl static void heap_unlock(Heap* heap) { if (heap->lock_impl.unlock_function) { heap->lock_impl.unlock_function(heap->lock_impl.lock_context); } // Handle any heap corruption that may have been detected while...
t_axis[i].negative_value = bmi160_read_16bit_reg(accel_test_axis[i].register_address); PBL_LOG(LOG_LEVEL_DEBUG, "- %c: %"PRId16, accel_test_axis[i].axis_name, accel_test_axis[i].negative_value); } PBL_LOG(LOG_LEVEL_DEBUG, "Self Test: Positive offset"); // Flip sign bit from negative to positive ...
{ interval <<= shift_val; }
else { interval >>= -shift_val; } return interval; } static BMI160AccODR prv_get_odr(BMI160SampleRate sample_rate) { // sample rate = 100 / 2^(8- val(acc_odr)) BMI160AccODR acc_odr = 0; if (BMI160SampleRate_12p5_HZ == sample_rate) { acc_odr = BMI160AccODR_12p5_HZ; } else if (BMI160SampleRate_25_...
return total_size; } va_list vl; va_start(vl, count); for (unsigned int i = 0; i < count; ++i) { total_size += va_arg(vl, unsigned int) + sizeof(Tuple); } va_end(vl); return total_size; } uint32_t dict_calc_buffer_size_from_tuplets(const Tuplet * const tuplets, const uint8_t tuplets_count) { uin...
if (tuplets_count == 0) { const Dictionary dict = { .count = 0 }; callback((const uint8_t *)&dict, sizeof(Dictionary), context); return DICT_OK; }
estamps_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, tz...
(&new_time, NULL)
; } void clock_protocol_msg_callback(CommSession *session, const uint8_t* data, unsigned int length) { char sub_command = *data++; switch (sub_command) { // Get time request: case 0x00: { time_t t = rtc_get_time(); // Send Get time response (0x01): const unsigned int response_buffer_len...
/* * 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 (!response) { return false; }
if (response->message_length < sizeof(HcProtocolMessage) + sizeof(DialogChipID)) { PBL_LOG(LOG_LEVEL_ERROR, "Received error response."); return false; } memcpy(chip_id_out, response->payload, sizeof(*chip_id_out)); kernel_free(response); return true; }
static void prv_finished(ProgressWindow *data, bool success) { if (data->callbacks.finished) { data->callbacks.finished(data, success, data->context); } } /////////////////////////////// // Animation Related Functions /////////////////////////////// static void prv_animation_stopped_success(Animation *animat...
(GColorLightGray, GColorWhite)
); data->is_peek_layer_used = true; } #if !PLATFORM_TINTIN // Animate the progress bar out, by shrinking it's width from it's current size down to 0. // When this completes, prv_animation_stopped_failure will show the peek layer. GRect *start = &data->progress_layer.layer.frame; GRect stop = *start; st...
pe != AnimationTypePrimitive) { // For a complex animation, check each component for (int child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx); if (!child) { break; } if (ch...
animation->handlers.stopped(animation->handle, finished, animation->context)
; } if (teardown && animation->did_setup) { if (animation->implementation->teardown != NULL) { animation->implementation->teardown(animation->handle); } animation->did_setup = false; } animation->calling_end_handlers = false; #ifdef UNITTEST // Make sure this animation didn't get deleted as...
()), 52200 * MS_PER_SECOND); rtc_set_time(s_friday_23_30); // In schedule do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off at 00:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_...
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND)
; rtc_set_time(s_saturday_00_00); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off at 10:00 on Saturday. (10 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 36000 * MS_PER_SECOND); rtc_set_time(s_saturday_10_3...
-224}, { 752, -128, -144}, { 832, -56, -144}, { 456, 16, -360}, { 768, 88, -376}, { 1312, 240, -512}, { 1288, 264, -376}, { 1184, 344, -344}, { 1120, 456, -240}, { 1184, 520, -280}, { 1216, 592, -176}, { 1168, 552, -128}, { 1144, 656, -160}, { 1072, 888, -80}, { 9...
{ 1488, 472, -320}, { 1544, 584, -368}, { 1464, 688, -288}, { 1336, 752, -296}, { 1128, 968, -304}, // 26 seconds { 1000, 1072, -216}, { 1040, 1128, -264}, { 1144, 856, -128}, { 1064, 768, -160}, { 1144, 632, -224}, { 1064, 440, -136}, { 1064, 368, -160}, { 1280, ...
{ 1240, 200, -128}, { 1248, 168, -88}, { 1264, 160, -80}, { 1136, 168, -56}, { 1032, 168, -104}, { 800, 40, -112}, { 752, -88, -32}, { 568, -8, -224}, { 608, 72, -416}, { 800, -32, -344}, { 1184, 64, -352}, { 1152, 96, -376}, { 1112, 248, -360}, { 1224, 336, -272...
text) { window_set_click_context(BUTTON_ID_UP, context); window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_DOWN, context); window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler); windo...
layer_add_child(&active_window->base_layer, &active_window->top_metric_layer); GRect scrollable_metric_bounds = top_metric_bounds; scrollable_metric_bounds.origin.y = scrollable_metric_bounds.size.h; scrollable_metric_bounds.size.h = window->layer.bounds.size.h - s...
GRect scrollable_metric_bounds = middle_metric_bounds; scrollable_metric_bounds.origin.y = top_metric_bounds.size.h + middle_metric_bounds.size.h; scrollable_metric_bounds.size.h = layer_height + 10; layer_init(&active_window->scrollable_metric_layer, &scrollable_metric_bounds); layer_set_update_pr...
{ if (alarms_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; } // Destroy the existing icon kino_reel_destroy(alarms_glance->icon); // Set the new icon and record its resource ID alarms_glance->icon = kino_reel_create_with_resource(new_icon_resource_id); P...
(structured_glance)
; // Get the first state of the glance prv_update_glance_for_next_alarm(alarms_glance); // Subscribe to alarm clock events for updating the glance alarms_glance->alarm_clock_event_info = (EventServiceInfo) { .type = PEBBLE_ALARM_CLOCK_EVENT, .handler = prv_alarm_clock_event_handler, .context = str...
E = 320; static const uint8_t TEST_DB_ID = 0x01; /* Helper functions */ static void prv_sent_data_cb(uint16_t endpoint_id, const uint8_t* data, unsigned int data_length) { s_sending_endpoint_id = endpoint_id; s_sending_data_length = data_length; memcpy(s_data, data, data_length); } ...
cl_assert(0 < token)
; cmd_ptr += sizeof(uint16_t); // check for a Database entry cl_assert(TEST_DB_ID == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // check for a key size cl_assert(TEST_KEY_SIZE == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // go past key_bytes cmd_ptr += TEST_KEY_SIZE; // size value ...
0}, .timestamp = 1421178061, // Tue Jan 13 11:41:01 2015 PST .duration = 1, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, ...
(first_time, &model)
; cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timelin...
le(this->periph, this->rcc_bit); } } static void prv_release_controller(DMAController *this) { const int refcount = atomic_fetch_sub(&this->state->refcount, 1) - 1; PBL_ASSERT(refcount >= 0, "Attempted to release a DMA controller that is not in use!"); if (refcount == 0) { periph_config_disable(this->perip...
mpu_memory_is_cachable(src)
) { // Flush the source buffer from cache so that SRAM has the correct data. uintptr_t aligned_src = (uintptr_t)src; size_t aligned_length = length; dcache_align(&aligned_src, &aligned_length); dcache_flush((const void *)aligned_src, aligned_length); } const uint32_t alignment_mask = prv_get_da...
/* * 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(!animation_private_using_legacy_2(NULL)); PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } uint32_t result = interpolate_uint32(distance_normalized, property_animati...
// ----------------------------------------------------------------------------------------- void property_animation_update_gpoint(PropertyAnimation *property_animation_h, const uint32_t distance_normalized) { if (animation_private_using_legacy_2(NULL)) { // We need to ena...
time_delta = 0, .gmt_offset_delta = 0, .dst_changed = true, } }; event_put(&e); s_dst_checker.cb_data = (void*)is_dst; } } void clock_init(void) { if (clock_is_timezone_set()) { TimezoneInfo tz_info; rtc_get_timezone(&tz_info); time_util_update_timezone(&tz_info); } ...
snprintf(number_buffer, number_buffer_size, "%ld", difference / SECONDS_PER_MINUTE)
; i18n_get_with_buffer(" MIN. TO", word_buffer, word_buffer_size); } else { prv_copy_time_string_timestamp(number_buffer, number_buffer_size, word_buffer, word_buffer_size, timestamp); } } else { // past time_t difference = now - timestamp; if (now < timestamp || difference < SECO...
pplication_id == AS7000AppId_Loader || hrm_info.sw_version_major != image_header.sw_version_major || hrm_info.sw_version_minor != image_header.sw_version_minor) { // We technically could leave the firmware on the HRM alone if the // minor version in the chip is newer than in the update image, but ...
(dev, false)
; gpio_analog_init(&dev->int_gpio); led_disable(LEDEnablerHRM); } mutex_unlock(dev->state->lock); }
ystem/logging.h" #include "system/passert.h" #include "util/attributes.h" #include <string.h> /* * Private */ static const uint8_t MIN_INTERVAL_MINUTES = 1; static const uint16_t ENDPOINT_ID = 0xcafe; static bool s_running = false; typedef enum { CMD_POLL = 0x0, // Formerly command poll mail LEGACY_CMD_REQUES...
{ PollRemoteCommand cmd = data[0]; switch (cmd) { case CMD_REQUEST_POLL: { PollRequestMessage *msg = (PollRequestMessage *)data; if (msg->service >= NUM_POLL_REMOTE_SERVICES) { return; } prv_send_request(&s_poll_remote_contexts[msg->service]); break; } case LEGACY_CMD_REQUEST_IN...
/* * Public */ static void poll_service_system_task_callback(void *data) { PBL_ASSERTN(s_running); for_each_context(context_interval_check); } static void poll_service_timer_callback(void *data) { system_task_add_callback(poll_service_system_task_callback, data); } void poll_remote_init(void) { for (int ...
LC * * 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 in writing, software * distri...
(timeline_layer.day_separator.kino_layer.player.animation)
estart(bitmap_sequence, true)) { goto cleanup; } int32_t frame_bytes = bitmap_sequence->png_decoder_data.read_cursor; frame_data_buffer = applib_zalloc(frame_bytes); if (frame_data_buffer == NULL) { goto cleanup; } const size_t bytes_read = sys_resource_load_range(app_num, resource_id, ...
if (!bitmap_sequence || (bitmap_sequence->play_count == 0 && bitmap_sequence->current_frame != 0)) { return false; }
GBitmapSequencePNGDecoderData *png_decoder_data = &bitmap_sequence->png_decoder_data; upng_t *upng = png_decoder_data->upng; // Check bitmap_sequence metadata is loaded, bitmap_sequence size, type & memory constraints const GBitmapFormat bitmap_format = gbitmap_get_format(bitmap); // call is NULL-safe if (...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
comm_session_set_responsiveness(session, BtConsumerPpAppMessage, ResponseTimeMin, MIN_LATENCY_MODE_TIMEOUT_APP_MESSAGE_SECS)
; // FIXME: Let the app task wait indefinitely for now const uint32_t timeout_ms = ~0; return comm_session_send_data(session, endpoint_id, data, length, timeout_ms); } DEFINE_SYSCALL(bool, sys_app_pp_has_capability, CommSessionCapability capability) { return comm_session_current_app_session_cache_has_capabili...
toi(timeout_10ms), }; GAPLEConnection *conn = prv_get_le_connection_and_print_info(); BTDeviceInternal addr = {}; if (conn) { addr.address = conn->device.address; } bt_driver_le_connection_parameter_update(&addr, &req); } // Not in a header because it's really only used from within the g...
prompt_send_response_fmt(buffer, sizeof(buffer), "BTLE PA set to: %s", s_btle_pa_config_strings[index])
f the backing storage static Tuple * get_safe_cursor(DictionaryIterator *iter) { // If iter->cursor is already at the end, return now so we don't try and read past the end of // the malloc'ed block (when fetching iter->cursor->length) and possibly cause a memory read // exception. if ((void*)iter->cursor >= it...
(iter, &tuplets[i])
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&BOARD_CONFIG.mic_config.mic_gpio_power, false)
; gpio_release(BOARD_CONFIG.mic_config.mic_gpio_power.gpio); } } static void prv_i2s_gpio_init(void) { // Enable the SPI clock periph_config_acquire_lock(); // [AS] TODO: If I2S is moved to SPI1, this RCC function needs to be abstracted to board.h PBL_ASSERTN(BOARD_CONFIG.mic_config.spi_clock_ctrl != R...
de "comm/remote.h" #include "process_management/app_run_state.h" #include "services/common/comm_session/protocol.h" #include "system/passert.h" #include "util/attributes.h" #include "util/list.h" #include <stdlib.h> // Stubs /////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h...
(s_launcher_deprecated_messages, 1)
; // When app_run_state is supported, should use app_run_state prv_set_expected(NOT_RUNNING); prv_set_remote_capability(CommSessionRunState); app_run_state_send_update(&s_app_uuid, NOT_RUNNING); cl_assert_equal_i(s_launcher_deprecated_messages, 1); cl_assert_equal_i(s_app_run_state_messages, 1); // Chan...
obile) { if (!notification_storage_get(id, item)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read notification"); goto cleanup; } } else if (type == NotificationReminder) { // validate reminder int rv = reminder_db_read_item(item, id); if (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "...
timeline_item_free_allocated_buffer(&reminder)
; TimelineItem item; if (S_SUCCESS != pin_db_get(&reminder.header.parent_id, &item)) { return; } timeline_item_free_allocated_buffer(&item); // Use the latest stale time to auto-hide the reminder. const time_t reminder_stale_time = prv_get_stale_time(&reminder); const time_t event_stale_time = prv_g...
s Codepoint codepoint = utf8_iter_state->codepoint; if (codepoint_should_skip(codepoint) || codepoint_is_formatting_indicator(codepoint)) { if (!iter_next(char_iter)) { return false; } } while (codepoint_is_zero_width(utf8_iter_state->codepoint)) { if (utf8_iter_state->codepoint == 0) { ...
(utf8_iter)
; codepoint = utf8_iter_state->codepoint; if (!is_utf8_advanced) { return is_utf8_advanced; } PBL_ASSERTN(codepoint != 0); if (codepoint_is_formatting_indicator(codepoint)) { continue; } if (codepoint_should_skip(codepoint)) { continue; }; return true; } } b...
battery_silhouette_frame, 3, 2); #if !PBL_COLOR // Fill the battery silhouette all the way for B&W, in order to make the BG black always. graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &battery_fill_rect); #endif // Adjust fill width for charge percentage, never filling belo...
graphics_text_node_container_add_child(&horizontal_container_node->container, vertically_centered_battery_icon_node)
; if (settings_glance->glance_state.battery_charge_state.is_plugged) { GTextNodeCustom *charging_icon_node = graphics_text_node_create_custom(prv_charging_icon_node_draw_cb, structured_glance); // Push the charging icon down to center it properly charging_icon_node->node.offset.y += subtitle_icon...
29VSCommand_SectorLock); int lock_flag = (lock ? 0 : 1) << 7; // set A6 to 0 to lock and 1 to unlock ((__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + sector_addr + lock_flag))[0] = S29VSCommand_SectorLock; } static uint16_t prv_read_manufacturer_id(void) { // Issue the DeviceIDEntry command to change to...
flash_impl_set_burst_mode(false)
le 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 in writing, software * di...
(prv_row_texts)
; } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, char const *title, int16_t offset) { // mostly copied from menu_cell_basic_draw_with_value // (that unfortunately doesn't respect bounds.origin.x) const int16_t title_height = 24; GRect box = layer_get_bounds(cell_layer); box.origin.x +...
[8]; prv_convert_seconds_to_time(value, elapsed, sizeof(elapsed)); APP_LOG(APP_LOG_LEVEL_DEBUG, "%d: %s", i, elapsed); char temp[32]; snprintf(temp, sizeof(temp), "\n%d: %s", i, elapsed); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); day_start -= SECO...
(window_layer, text_layer_get_layer(data->sleep_card.text_layer))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return &s_worker_state_ptr->tick_timer_service_state; }
e.is_plugged) { s_charger_plugged = true; s_current_cal_status = CompassStatusDataInvalid; memset(s_active_corr, 0x00, sizeof(s_active_corr)); prv_reset_saved_sample(); } else if (s_charger_plugged) { // we have unplugged the charger, initiate recalibration s_charger_plugged = false; s_cal...
(s_active_corr)
; s_current_cal_status = CompassStatusCalibrated; } } // get the most recent accel readings AccelRawData accel_data = s_accel_data; int32_t roll = 0, pitch = 0; prv_get_roll_and_pitch(&accel_data, &roll, &pitch); PebbleEvent e = { .type = PEBBLE_COMPASS_DATA_EVENT, .compass_data = { ...
as_chg_en()) { // Initialize PD2 as the sensor enable GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; if (boar...
{ bool value = atoi(bool_str); PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = value, } }; event_put(&event); }
PREF_KEY_VIBE_SCORE_NOTIFICATIONS, strlen(PREF_KEY_VIBE_SCORE_NOTIFICATIONS)); if (!user_has_migrated_to_vibe_scores) { // If the user previously set a vibration intensity, set the vibe scores based on that intensity if (settings_file_exists(file, PREF_KEY_VIBE_INTENSITY, strlen(PREF...
settings_file_open(&file, FILE_NAME, FILE_LEN)
TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } // Simulate receiving an ack for the last, after the roll-back, but before the packets are // retransmitted (the last part shouldn't matter much, but simplifies the test a bit) prv_receive_ack(s_characteristics[0][PPoGATTCharac...
(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn), true)
aggregation); } else { return prv_compute_aggregate_averaged_using_daily_totals(state, metric, time_start, time_end, aggregation, scope); } #endif } // -----------------------------------------------------...
(app_id, interval_sec, 0 /*expire_sec*/, HRMFeature_BPM)
; if (hrm_session == HRM_INVALID_SESSION_REF) { PBL_LOG(LOG_LEVEL_ERROR, "Error subscribing"); return false; } return true; #endif } // ---------------------------------------------------------------------------------------------- uint16_t health_service_get_heart_rate_sample_period_expiration_sec(void)...
grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, -5.5, -10.5); cl_assert_fixedS16_3(radius, 4.5); } void test_graphics_circle__grect_polar_calc_values_square(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; GRect r = GRect(0, 0, 5, 5); GOvalScaleMode mode = G...
(NULL, GRect(0, 0, 10, 12), GOvalScaleModeFitCircle, 3, 0, 0)
; cl_assert_gpoint_precise(s_center, 4.5, 5.5); cl_assert_fixedS16_3(s_radius_outer, 4.5); cl_assert_fixedS16_3(s_radius_inner, 1.5); } void test_graphics_circle__DEG_TO_TRIGANGLE(void) { cl_assert_equal_i(DEG_TO_TRIGANGLE(720), TRIG_MAX_ANGLE * 2); cl_assert_equal_i(DEG_TO_TRIGANGLE(-720), -TRIG_MAX_ANGLE *...
ion__property_int16(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; int16_t value = 0; int16_t start_value = 0, end_value = 100; const int duration = 200; const int delay = 25; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; s...
GPoint(100, 200)
; prop_h = property_animation_create(&implementation, &value, &start_value, &end_value); Animation *h = property_animation_get_animation(prop_h); void *context = &value; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_set_delay(h, delay); animation_set_auto_des...
der_bpm(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); const int units_offset_y = fonts_get_font_height(data->bpm_font) - fonts_get_font_height(data->units_font); GTextNodeHorizontal *horiz_container = graphics_text_node_create_horizontal(MAX_TEXT_NODES); ...
{ // create base layer Layer *base_layer = layer_create_with_data(GRectZero, sizeof(HealthHrSummaryCardData)); HealthHrSummaryCardData *data = layer_get_data(base_layer); layer_set_update_proc(base_layer, prv_base_layer_update_proc); // set health data *data = (HealthHrSummaryCardData) { .health_data = ...
void health_hr_summary_card_select_click_handler(Layer *layer) { HealthHrSummaryCardData *data = layer_get_data(layer); HealthData *health_data = data->health_data; Window *window = health_hr_detail_card_create(health_data); window_set_window_handlers(window, &(WindowHandlers) { .unload = prv_hr_detail_ca...
defined(PBL_ROUND) expandable_dialog_set_header_font(expandable_dialog, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); #endif // Show immediately since this is the first window and there is already a compositor animation app_window_stack_push(&expandable_dialog->dialog.wind...
("Alarms")
, #if CAPABILITY_HAS_APP_GLANCES .icon_resource_id = RESOURCE_ID_ALARM_CLOCK_TINY, #elif PLATFORM_TINTIN .icon_resource_id = RESOURCE_ID_MENU_LAYER_ALARMS_APP_ICON, #endif }; return (const PebbleProcessMd*) &s_alarms_app_info; }
b, duration_b); animation_set_delay(b, delay_b); // Should be an error trying to use a scheduled animation not in the first position Animation *seq = animation_sequence_create(b, a, NULL); cl_assert(seq == NULL); seq = animation_sequence_create(a, b, NULL); animation_set_delay(seq, delay_seq); // This del...
animation_set_duration(b, duration_b)
; animation_set_delay(b, delay_b); Animation *seq = animation_sequence_create(a, b, NULL); animation_set_handlers(seq, handlers, seq); animation_schedule(seq); // The duration of seq should include all of a and b uint32_t duration = animation_get_duration(seq, true, true); cl_assert_equal_i(duration, du...
_dialog_discoverable_type_for_flag(uint8_t flags) { if (flags & GAP_LE_AD_FLAGS_GEN_DISCOVERABLE_MASK) { return GAP_DISC_MODE_GEN_DISCOVERABLE; } else if (flags & GAP_LE_AD_FLAGS_LIM_DISCOVERABLE_MASK) { return GAP_DISC_MODE_LIM_DISCOVERABLE; } else { return GAP_DISC_MODE_NON_DISCOVERABLE; } } ble_...
prv_advert_enable()
pbl_override_localtime(&now)->tm_sec; uint32_t miliseconds = seconds * 1000 + now_ms; uint32_t rotation = miliseconds * TRIG_MAX_ANGLE / (60 * 1000); GPointPrecise p0; GPointPrecise p1; p0.x.raw_value = (data->canvas_layer->bounds.size.w / 2) * FIXED_S16_3_ONE.raw_value; p0.y.raw_value = (dat...
layer_destroy(data->canvas_layer)
; layer_destroy(data->debug_layer); } static void init(void) { AppData *data = task_zalloc(sizeof(AppData)); if (!data) { return; } s_window = window_create(); window_set_user_data(s_window, data); window_set_fullscreen(s_window, true); window_set_window_handlers(s_window, &(WindowHandlers) { ...
(errors & USART_ISR_FE) != 0, .noise_detected = (errors & USART_ISR_NE) != 0, }; return flags; } bool uart_is_rx_ready(UARTDevice *dev) { return dev->periph->ISR & USART_ISR_RXNE; } bool uart_has_rx_overrun(UARTDevice *dev) { return dev->periph->ISR & USART_ISR_ORE; } bool uart_has_rx_framing_error(UART...
portEND_SWITCHING_ISR(should_context_switch)
; } void uart_clear_all_interrupt_flags(UARTDevice *dev) { dev->periph->RQR |= USART_RQR_RXFRQ; dev->periph->ICR |= USART_ICR_ORECF; } // DMA //////////////////////////////////////////////////////////////////////////////// void uart_start_rx_dma(UARTDevice *dev, void *buffer, uint32_t length) { dev->periph->C...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dbgserial_newline()
; } void boot_version_write(void) { if (boot_version_read() == s_bootloader_timestamp) { return; } RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp); } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
/* * 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...
accessory_set_power(true)
e_size, 16); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x0F, 0x2); cl_assert_equal_i(s_flush_addr, 0x00); cl_assert_equal_i(s_flush_size, 0x20); cl_assert_equal_i(s_invalidate_addr, 0x00); cl_assert_equal_i(s_invali...
(s_invalidate_addr, 0x20)
; cl_assert_equal_i(s_invalidate_size, 0x01); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); } void test_cpu_cache__without_cache(void) { cl_will_return(icache_is_enabled, false); cl_will_return(dcache_is_enabled, false); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1...
mTypeNotification) || (item->header.type == TimelineItemTypeReminder)) && !timeline_get_private_data_source((Uuid *)&item->header.parent_id))) { prv_dismiss_local_notification_action(item); return; } // FALLTHROUGH case TimelineItemActionTypeGeneric: case Timel...
pin_db_each(prv_count_each, &analytics_info)
; analytics_set(ANALYTICS_DEVICE_METRIC_TIMELINE_PINS_VISIBLE_CALENDAR_COUNT, analytics_info.visible_count.calendar, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_TIMELINE_PINS_VISIBLE_OTHER_COUNT, analytics_info.visible_count.other, AnalyticsClient_System); analy...
(LOG_LEVEL_ERROR, "Invalid packet received")
; return; } ACCEL_LOG_DEBUG("Got accel msg from host: num samples: %d", hdr->num_samples); // Copy the received samples into the s_rcv_buffer #if QEMU_ACCEL_RCV_BUFFER_SAMPLES < 256 s_num_rcv_samples = MIN(hdr->num_samples, QEMU_ACCEL_RCV_BUFFER_SAMPLES); #else s_num_rcv_samples...
ata->certification_data.kcc_mark); gbitmap_deinit(&data->certification_data.ce_mark); gbitmap_deinit(&data->certification_data.weee_mark); gbitmap_deinit(&data->certification_data.r_mark); gbitmap_deinit(&data->certification_data.t_mark); gbitmap_deinit(&data->certification_data.aus_rcm_mark); gbitmap_deini...
(&data->kcc_window, data)
; window_set_window_handlers(&data->kcc_window, &(WindowHandlers) { .load = prv_kcc_window_load, .unload = prv_kcc_window_unload, }); app_window_stack_push(&data->kcc_window, true); } // Callbacks for the main settings filter list menu. //////////////////////////////////////////////////// #define SHUTDO...
/* * 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(circular_buffer_consume(&buffer, 1))
; // Read the last little bit cl_assert(circular_buffer_read(&buffer, 1, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buffer, (uint8_t*) "c", 1) == 0); cl_assert(circular_buffer_consume(&buffer, 1)); // And we should be empty cl_assert(!circular_buffer_read(&buffer,...
{ -96, 936, -16}, { -104, 928, -16}, { -104, 928, -8}, { -104, 928, -16}, { -96, 936, -24}, { -96, 936, -8}, { -104, 936, -16}, { -96, 928, -16}, { -96, 936, -16}, { -104, 936, -8}, { -104, 936, -16}, { -96, 928, -16}, { -104, 936, -24}, { -96, 928, -16}, { -96,...
{ -96, 936, -24}, { -88, 928, -24}, // 234 seconds { -96, 936, -24}, { -96, 928, -24}, { -96, 928, -24}, { -96, 936, -24}, { -96, 936, -24}, { -96, 928, -24}, { -96, 936, -24}, { -104, 928, -24}, { -96, 928, -24}, { -104, 928, -32}, { -96, 936, -24}, { -96, 92...
{ -96, 928, -32}, { -96, 936, -24}, { -96, 928, -24}, { -96, 936, -32}, { -96, 928, -32}, { -88, 928, -32}, { -96, 928, -24}, { -96, 928, -24}, { -96, 928, -24}, { -96, 928, -32}, { -88, 928, -32}, { -96, 928, -24}, { -96, 928, -24}, { -96, 928, -32}, { -96, ...
e "drivers/dbgserial.h" #include "drivers/display.h" #include "drivers/flash.h" #include "drivers/system_flash.h" #include "firmware.h" #include "flash_region.h" #include "system/bootbits.h" #include "system/firmware_storage.h" #include "system/reset.h" #include "util/crc32.h" #include "util/misc.h" #include "util/dela...
(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS)
) { dbgserial_putstr("Our previous firmware update failed, aborting update."); // Pretend like the new firmware bit wasn't set afterall. We'll just run the // previous code, whether that was normal firmware or the recovery firmware. boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); boot_bit_clear...
itions.h" #include "services/common/compositor/compositor_private.h" #include "services/common/compositor/compositor_transitions.h" #include "apps/system_apps/timeline/timeline_common.h" #include "applib/graphics/bitblt.h" #include "applib/graphics/framebuffer.h" #include "applib/graphics/gtypes.h" #include "applib/u...
(&dest_bitmap, shift_start_row, shift_end_row, shift_amount)
; } if (s_data.timeline_is_destination) { #if CAPABILITY_HAS_TIMELINE_PEEK if (!s_data.timeline_is_empty) { graphics_context_set_fill_color(ctx, GColorWhite); const int content_width = DISP_COLS - TIMELINE_PEEK_ICON_BOX_WIDTH; graphics_fill_rect(ctx, &GRect(0, fill_offset_y, content_width, fil...
////////////////////////////////////////// #define assert_float_parse(in, mul, succeeds, expected_result) \ { \ const char *input = (const char *)in; \ const uint32_t input_length = input ? sizeof(in) : 0; \ const uint32_t multiplier = mul; \ int32_t result = 0; \ cl_assert_equal_b(succeeds, \ ...
(empty_string, s_results[0])
; } void test_ams_util__csv_empty_values(void) { const char one_value[] = ","; const uint8_t count = ams_util_csv_parse(one_value, sizeof(one_value), NULL, prv_result_callback); cl_assert_equal_i(s_results_count, 2); cl_assert_equal_i(count, 2); assert_result(0, "",...
) &header, sizeof(header), COMM_SESSION_DEFAULT_TIMEOUT); } else { // Otherwise, just send a "done" message header.command = 0x81; comm_session_send_data(s_bt_dump_chunk_callback_data.comm_session, ENDPOINT_ID, (uint8_t *) &header, sizeof(header), COMM...
(LOG_LEVEL_INFO, build_id, sizeof(build_id))
; } } }
} solution[2] = shift_factor[2] + sphere_determinant4x4(matrix, c00 * 2); rv = true; cleanup: for (int i = 0; i < N_SAMPS; i++) { kernel_free(matrix[i]); } kernel_free(matrix); return (rv); } // Earths magnetic field intensity ranges from 25uT (near the equator) to 65uT // (near the earths poles). A...
if (vals[i] > max) { max = vals[i]; } else if (vals[i] < min) { min = vals[i]; }
} return (max - min); } #define N_COMP_SAMPS 3 static MagCalStatus check_correction_value(int16_t *solution, int16_t *saved_solution) { const int max_delta_thresh = 50; // stash several of the most recent calibration results. The idea here is if // we get multiple readings in a row close to one another...
ickManager* prv_get_current_click_manager(void) { return window_manager_get_window_click_manager(window_manager_get_top_window()); } static void prv_call_click_provider(Window *window) { window->is_waiting_for_click_config = false; app_click_config_setup_with_window(prv_get_current_click_manager(), window); wi...
{ Window *window = window_manager_get_top_window(); window_set_overrides_back_button(window, true); }
} ClickManager *mgr = prv_get_current_click_manager(); ClickConfig *cfg = &mgr->recognizers[button_id].config; cfg->long_click.delay_ms = (delay_ms == 0) ? 500 : delay_ms; cfg->long_click.handler = down_handler; cfg->long_click.release_handler = up_handler; } void window_raw_click_subscribe(ButtonId butt...
(&ctx, GColorGreen)
; graphics_fill_radial(&ctx, radial_container_rect, GOvalScaleModeFillCircle, inset_thickness, 0, TRIG_MAX_ANGLE / 2); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("off_screen_right_aa_clipping"))); };
tic = prv_get_indicatable_characteristic(); fake_kernel_malloc_mark(); // Try to subscribe for notifications to the indicatable (but not notify-able) characteristic: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionNotifications, GAPLEClientKernel);...
prv_assert_no_event()
cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id)); cl_assert(!iter_next(&iterator)); } // 11 am void test_timeline__extra_case_none_fo...
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id))
ext_layer_set_text(&data->text_layer, text_buffer); GFont gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); text_layer_set_font(&data->text_layer, gothic_24_bold); text_layer_set_text_alignment(&data->text_layer, GTextAlignmentCenter); text_layer_set_overflow_mode(&data->text_layer, GTextOverflow...
GRect(4, 4, 72, 32)
); // Init direction layer text_layer_init(&data->direction_layer, &GRect(5, 100, 135, 20)); text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->direction_layer, GColorBlack); text_layer_set_text(&data->direction_layer, "Direction: Up/Down"); GFont gothic_...
/* * 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->title_text_layer, "ALS")
; text_layer_set_text_alignment(data->title_text_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(data->title_text_layer)); bounds.origin.y += 30; data->reading_text_layer = text_layer_create(bounds); prv_update_reading(data); text_layer_set_font(data->reading_text_layer, ...
r_add_child(&parent, &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_b.next_sibling == &child_c); layer_add_child(&child_a, &grand_child_a); cl_assert(grand_child_a.parent == &child_a); // Remove non-first-child (child_b): // // +-parent // | // '->child_a->child_c // ...
(GRectZero)
; Layer *aaaa = layer_create(GRectZero); Layer *ab = layer_create(GRectZero); Layer *b = layer_create(GRectZero); layer_add_child(a, aa); layer_add_child(aa, aaa); layer_add_child(aaa, aaaa); layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child if possible Layer *actual = _...
/* * 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...
{ __atomic_and_fetch(&PWR->CR1, ~PWR_CR1_DBP, __ATOMIC_RELAXED); }
periph_config_disable(PWR, RCC_APB1Periph_PWR); } bool pwr_did_boot_from_standby(void) { bool result = (PWR->CSR1 & PWR_CSR1_SBF) != 0; return result; } void pwr_clear_boot_from_standby_flag(void) { PWR->CR1 |= PWR_CR1_CSBF; }
/* * 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_iter_to_valid_mbuf(iter)
es // http://opengameart.org/content/greyscale-special-effects-%E2%80%94-various-dimensions-and-flavours // http://opengameart.org/content/bouncing-ball-guy // http://opengameart.org/content/medals-3 // http://opengameart.org/content/open-pixel-platformer-tiles-sprites #if SCREEN_COLOR_DEPTH_BITS == 8 #include "applib...
cl_assert(bitmap)
; // first frame always shows at the beginning (0 ms) status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 0); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1))); // each frame has delay 100ms, so (33 - 1) * 100 ms shows 33rd frame status = gbitmap_...
l_i(window->is_waiting_for_click_config, false); window_stack_pop(stack, false); cl_assert_equal_i(window_stack_count(stack), 0); // Ensure the disappear handler was called cl_assert_equal_i(prv_get_appear_disappear_count(), 0); // Ensure the unload handler was called cl_assert_equal_i(prv_get_load_unlo...
cl_assert_equal_i(window_stack_count(stack), 1)
----------------- // Sample captured: 2015-08-11 22:02:59 GMT AccelRawData *activity_sample_200_steps(int *len) { //> TEST_NAME walk_200 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 190 //> TEST_EXPECTED_MAX 210 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { { 163, -135, -713}, { 194, -165, -8...
{ 1262, 506, -200}, { 1026, 356, 28}, { 828, 215, 108}, { 917, 240, 50}, { 889, 346, 52}, { 854, 390, 83}, { 852, 407, 22}, { 858, 379, 14}, { 941, 389, -2}, { 1124, 419, -42}, { 1227, 519, -97}, { 1206, 516, -25}, { 1393, 508, 0}, { 1185, 458, 41}, { 1274, 46...
{ 1057, 365, 89}, { 931, 332, 125}, { 839, 251, 152}, { 815, 184, 162}, { 825, 152, 185}, { 763, 158, 150}, { 812, 177, 164}, { 1019, 162, 246}, { 1049, 169, 219}, { 1184, 260, 114}, { 1400, 268, 141}, { 1073, 375, -61}, { 1169, 415, -140}, { 1012, 257, 32}, ...