prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
PBL_LOG(LOG_LEVEL_ERROR, "Unknown cmd ID: 0x%"PRIx8, msg->command_id);
} |
bool hc_endpoint_chip_id_query_chip_info(DialogChipID *chip_id_out) {
HcProtocolMessage request = {
.message_length = sizeof(request),
.endpoint_id = HcEndpointID_Id,
.command_id = HcMessageID_Id_ChipInfo,
};
HcProtocolMessage *response = hc_protocol_enqueue_and_expect(&request);
if (!response) {
... |
.h = src_bitmap->bounds.size.h + src_bitmap->bounds.origin.y
};
bitmap = gbitmap_create_blank(size, GBitmapFormat1BitPalette);
if (bitmap) {
// Perform conversion
uint8_t *src_data = (uint8_t *)src_bitmap->addr;
uint8_t *dest_data = (uint8_t *)bitmap->addr;
for (int y = 0; y < bitmap... | {
const bool result = gbitmap_init_with_png_data(bitmap, data, data_size);
// the actual pixels live uncompressed on the heap now, we can free the PNG data
applib_resource_munmap_or_free(data);
return result;
} |
const bool mmapped = applib_resource_is_mmapped(data);
if (prv_init_with_pbi_data(bitmap, data, data_size, mmapped)) {
// in order to make memory-mapped bitmaps work, we need to decrement the reference counter
// when we destroy it. This case is different from a sub-bitmap that shares the bitmap
// 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... | {
len = buffer->buffer_size - client->read_index;
len += buffer->write_index;
} |
return len;
}
// -------------------------------------------------------------------------------------------------
// Returns max amount of data available among all clients
// On exit, *max_client will contain the client with the most amount of data available
static uint32_t prv_get_max_data_length(const SharedCi... |
nt_blob);
}
// ------------------------------------------------------------------------------------------
// Log local bluetooth disconnection reason
void analytics_event_local_bt_disconnect(uint16_t conn_handle, uint32_t lr) {
AnalyticsEventBlob event_blob = {
.event = AnalyticsEvent_LocalBtDisconnect,
};
... | {
memcpy(event_blob.app_crash_report.build_id_slice, build_id,
sizeof(event_blob.app_crash_report.build_id_slice));
} |
#if LOG_DOMAIN_ANALYTICS
char uuid_string[UUID_STRING_BUFFER_LENGTH];
uuid_to_string(uuid, uuid_string);
ANALYTICS_LOG_DEBUG("App Crash event: uuid:%s, pc: %p, lr: %p",
uuid_string, (void *)pc, (void *)lr);
#endif
analytics_logging_log_event(&event_blob);
}
extern bool comm_session_is_... |
eturn false;
}
// Ask the compass for a 8-bit value that's programmed into the IC at the
// factory. Useful as a sanity check to make sure everything came up properly.
bool mag3110_check_whoami(void) {
static const uint8_t COMPASS_WHOAMI_BYTE = 0xc4;
uint8_t whoami = 0;
mag_use();
mag3110_read(WHO_AM_I_REG, ... | mag3110_write(CTRL_REG1, new_sample_rate_value | 0x01) | ) {
goto done;
}
success = true;
done:
mutex_unlock(s_mag_mutex);
return (success);
}
void mag_start_sampling(void) {
mag_use();
// enable automatic magnetic sensor reset & RAW mode
mag3110_write(CTRL_REG2, 0xA0);
mag_change_sample_rate(MagSampleRate5Hz);
}
|
char *text_buffer, bool highlight) {
GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD);
text_layer_set_font(text_layer, font);
if (highlight) {
text_layer_set_background_color(text_layer, GColorWhite);
text_layer_set_text_color(text_layer, GColorBlack);
} else {
text_layer_set_background_c... | graphics_context_set_stroke_color(ctx, bg_color) | ;
graphics_draw_pixel(ctx, point);
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y));
graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1));
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1));
}
}
static void draw_color_rect(GContext* ctx, AppData *data, GRect rect) {
uint16_t width =... |
/*
* 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 (buffer_length < 11) {
dbgserial_putstr("itoa buffer too small");
return;
} | |
/*
* 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_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR);
} |
return path;
}
void gpath_destroy(GPath* gpath) {
applib_free(gpath);
}
static GPoint rotate_offset_point(const GPoint *orig, int32_t rotation, const GPoint *offset) {
int32_t cosine = cos_lookup(rotation);
int32_t sine = sin_lookup(rotation);
GPoint result;
result.x = (int32_t)orig->x * cosine / TRIG_MA... |
/*
* 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, 92, 60, 60) | ;
GRect tmp;
if (toggle) {
tmp = to_rect_b;
to_rect_b = from_rect_b;
from_rect_b = tmp;
}
toggle = !toggle;
animation_destroy(s_animation);
s_animation = NULL;
PropertyAnimation *a = property_animation_create_layer_frame(layer, &from_rect_a, &to_rect_a);
animation_set_duration((Animation*... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
switch (header->state) {
case STATE_WRITE:
prv_wait_for_flash_not_busy();
for (uint32_t i = 0; i < header->length / sizeof(p_size_t); i++) {
header->addr[i] = data[i];
__asm__("isb 0xF":::"memory");
__asm__("dsb 0xF":::"memory");
/// Wait until flash 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... | (exti_line) | ;
prv_lock();
switch (trigger) {
case ExtiTrigger_Rising:
EXTI->RTSR |= prv_exti_line_to_bit(exti_line);
EXTI->FTSR &= ~prv_exti_line_to_bit(exti_line);
break;
case ExtiTrigger_Falling:
EXTI->RTSR &= ~prv_exti_line_to_bit(exti_line);
EXTI->FTSR |= prv_exti_line_to_bit(exti_line);
break... |
BlobDBToken token;
BlobDBResponse result;
uint8_t num_ids;
BlobDBId db_ids[NumBlobDBs];
} response = {
.cmd = BLOB_DB_COMMAND_DIRTY_DBS_RESPONSE,
.token = *(BlobDBToken *)data,
.result = BLOB_DB_SUCCESS,
};
blob_db_get_dirty_dbs(response.db_ids, &response.num_ids);
// we don't want... | prv_send_response(session, (uint8_t *)&response, sizeof(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... | MIN(DISP_ROWS_LAST_INDEX,
interpolate_int16(distance_normalized,
0,
DISP_ROWS_LAST_INDEX)) | ;
// This is the delta between the new offset and the previous offset.
const int32_t modal_offset_delta_y = new_modal_offset_y - s_data.cur_modal_offset_y;
if (modal_offset_delta_y == 0) {
// if we aren't going to move the modal, just bail
return;
}
// Start from the bottom of the display (last row ... |
CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersTop);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_top.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLI... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_topright.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomLeft);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_bottomleft.${BIT_DEPTH_NAME}.pbi"));
setu... |
L_DEBUG, "start the loop");
#if TEST_HCI_ROM_PASSTHROUGH
test_hci_passthrough();
#endif
// Signal to the initing task that the BLE stack is up and running now!
xSemaphoreGive(init_info->semph);
for (;;) {
BaseType_t ret;
uint32_t notif;
sys_watchdog_notify(s_ble_perip_wdog_id);
sys_watchdog_... | ((const ble_evt_gattc_write_completed_t *)hdr) | ;
break;
case BLE_EVT_GATTC_NOTIFICATION:
gatt_wrapper_handle_notification((const ble_evt_gattc_notification_t *)hdr);
break;
case BLE_EVT_GATTC_INDICATION:
gatt_wrapper_handle_indication((const ble_evt_gattc_indication_t *)hdr);
break;
case I... |
am6:
*has_tc = this->stream->controller->periph->HISR & DMA_HISR_TCIF6;
*has_ht = this->stream->controller->periph->HISR & DMA_HISR_HTIF6;
break;
case (uintptr_t)DMA1_Stream7:
case (uintptr_t)DMA2_Stream7:
*has_tc = this->stream->controller->periph->HISR & DMA_HISR_TCIF7;
*has_ht =... | PBL_ASSERTN(this->stream->controller->periph == DMA1) | ;
break;
case (uintptr_t)DMA2_Stream0:
case (uintptr_t)DMA2_Stream1:
case (uintptr_t)DMA2_Stream2:
case (uintptr_t)DMA2_Stream3:
case (uintptr_t)DMA2_Stream4:
case (uintptr_t)DMA2_Stream5:
case (uintptr_t)DMA2_Stream6:
case (uintptr_t)DMA2_Stream7:
PBL_ASSERTN(this->stream->c... |
num_heart_beats < max_heart_beats) {
data->pulsing_heart_timer = app_timer_register(timer_duration,
prv_pulsing_heart_timer_cb,
base_layer);
}
layer_mark_dirty(base_layer);
}
static void prv_render_progress_b... | if (!activity_prefs_heart_rate_is_enabled()) {
prv_render_hrm_disabled(ctx, base_layer);
return;
} |
prv_render_bpm(ctx, base_layer);
prv_render_timstamp(ctx, base_layer);
}
static void prv_hr_detail_card_unload_callback(Window *window) {
health_hr_detail_card_destroy(window);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// API Functions
//
Layer *h... |
me = 3 * MINUTES_PER_HOUR + 30;
steps = running_cadence_spm * long_run_time;
time_ms = long_run_time * SECONDS_PER_MINUTE * MS_PER_SECOND;
int long_run_distance_m = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER;
cl_assert_within(long_run_distance_m, 40000, 44000);
// Now make a shorter ... | cl_assert_equal_i(1155, activity_private_compute_resting_calories(long_time_m) / ACTIVITY_CALORIES_PER_KCAL) | |
t_equal_i(2, current_stack);
cl_assert_equal_p(a, stack[0]);
cl_assert_equal_p(aa, stack[1]);
cl_assert_equal_p(aaa, stack[2]);
// go to child if possible
actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), ¤t_stack, true);
cl_assert_equal_p(aaaa, actual);
cl_assert_equal... | (layer_find_layer_containing_point(&child_a, &GPoint(0, 0)), &child_a) | ;
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(10, 10)), &parent);
layer_add_child(&child_a, &child_f);
cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_f);
cl_a... |
= 2;
GRect frame = cell_layer->bounds;
// manually inset the frame to save stack space, instead of using grect_inset
frame.origin.x += horizontal_inset;
frame.size.w -= horizontal_inset * 2;
frame.origin.y += top_inset;
frame.size.h -= top_inset;
// Using TextStyleFont_Header here is a little bit of a ha... | ("Clear All", data) | , NULL, NULL);
#else
const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
GRect box = cell_layer->bounds;
box.origin.y += 6;
graphics_draw_text(ctx, i18n_get("Clear All", data), font, box,
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter,... |
ld(context_2d, ROCKY_CONTEXT2D_CANVAS);
{
JS_VAR client_width = jerry_create_number(layer->bounds.size.w);
JS_VAR client_height = jerry_create_number(layer->bounds.size.h);
jerry_set_object_field(canvas, ROCKY_CANVAS_CLIENTWIDTH, client_width);
jerry_set_object_field(canvas, ROCKY_CANVAS_CLIENTHEIGHT,... | {
uint8_t width;
ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR(
ROCKY_ARG(width),
);
graphics_context_set_stroke_width(rocky_api_graphics_get_gcontext(), width);
return jerry_create_undefined();
} |
JERRY_FUNCTION(prv_get_stroke_width) {
return jerry_create_number((double)rocky_api_graphics_get_gcontext()->draw_state.stroke_width);
}
static jerry_value_t prv_graphics_set_color(const jerry_length_t argc,
const jerry_value_t argv[],
... |
splay_busy(void) {
return gpio_input_read(&ICE40LP->busy);
}
void display_spi_begin_transaction(void) {
spi_ll_slave_acquire(ICE40LP->spi_port);
spi_ll_slave_scs_assert(ICE40LP->spi_port);
power_tracking_start(PowerSystemMcuSpi6);
}
void display_spi_end_transaction(void) {
spi_ll_slave_scs_deassert(ICE40LP-... | periph_config_release_lock() | |
er_Falling, prv_as3701b_interrupt_handler);
exti_enable(BOARD_CONFIG_POWER.pmic_int);
const uint8_t mask = (uint8_t) ~(PmicInt1_LowBat | PmicInt1_ChDet | PmicInt1_EOC);
prv_write_register(PmicRegisters_INT_MASK_1, mask);
prv_write_register(PmicRegisters_INT_MASK_2, ~0);
}
// Set up 160Hz clock which is used f... | {
return s_last_reset_reason;
} |
bool pmic_init(void) {
s_debounce_charger_timer = new_timer_create();
prv_init_gpio();
if (!prv_is_alive()) {
return false;
}
prv_stash_last_reset_reason();
prv_init_pmic_gpio_outputs();
prv_set_sd1_voltage();
prv_start_160hz_clock();
prv_configure_battery_measure();
prv_configure_interrupt... |
ePopCard:
return (next_state == TimelineAppStateStationary ||
next_state == TimelineAppStatePushCard);
case TimelineAppStateNoEvents:
return (next_state == TimelineAppStateInactive);
case TimelineAppStateInactive:
case TimelineAppStateExit:
return false;
default:
WT... | {
if (data->timeline_model.direction == TimelineIterDirectionPast) {
icon_frame.origin.y -= DISP_ROWS;
} else {
icon_frame.origin.y += DISP_ROWS;
}
} |
*icon_frame_out = icon_frame;
#endif
}
static Animation *prv_create_peek_exit_anim(TimelineAppData *data, TimelineAppState prev_state,
uint32_t duration) {
PeekLayer *peek_layer = &data->peek_layer;
if (prev_state == TimelineAppStateNoEvents ||
prev_state == Tim... |
PutRequest) + payload_size];
PutRequest *put_msg = (PutRequest *)buffer;
*put_msg = (PutRequest) {
.cmd = CmdPut,
.cookie = htonl(s_last_response_cookie),
.payload_size = htonl(payload_size) + 1 /* one off! */,
};
memcpy(&put_msg->payload[0], chunk, payload_size);
prv_receive_data(s_session, buff... | (&buffer[i], &towrite, sizeof(towrite)) | ;
}
// Make sure we can receive new data in the middle of a pb_storage_append operation
for (int i = 0; i < num_ops; i += 2) {
int idx = i * VALID_OBJECT_SIZE;
prv_receive_put(s_last_response_cookie, &buffer[idx], VALID_OBJECT_SIZE);
idx += VALID_OBJECT_SIZE;
memcpy(&s_next_value_to_write, &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... | text_layer_set_text(&data->text_layer, "Started.") | ;
(void)animation;
}
static void animation_stopped(Animation *animation, bool finished, AnimatedDemoData *data) {
text_layer_set_text(&data->text_layer, finished ? "Hi, I'm a TextLayer!" : "Just Stopped.");
(void)animation;
}
AnimationProgress animation_bounce(AnimationProgress linear_distance) {
// An awful ... |
/*
* 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... | (connection, BtConsumerLePairing,
ResponseTimeMin, max_period_secs) | ;
PairingUserConfirmationCtx *ctx = (PairingUserConfirmationCtx *)connection;
bt_driver_cb_pairing_confirm_handle_request(ctx, NULL /* device name */,
NULL /* "just works", so no token */);
bluetooth_analytics_handle_ble_pairing_request();
}
void pairing_confirm_ha... |
gdraw_command_image_get_command_list(((KinoReelImplPDCI*)reel)->image) | ;
}
return NULL;
}
static const KinoReelImpl KINO_REEL_IMPL_PDCI = {
.reel_type = KinoReelTypePDCI,
.destructor = prv_destructor,
.get_size = prv_get_size,
.get_data_size = prv_get_data_size,
.draw_processed = prv_draw_processed_func,
.get_gdraw_command_image = prv_get_gdraw_command_image,
.get_gdraw... | |
animation_spawn_create(seq, c, NULL);
cl_assert(complex != NULL);
animation_set_handlers(complex, handlers, complex);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(complex);
// -------------------------------------------------------------------------------------
/... | prv_count_handler_entries(&s_started_handler_calls, a) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b),... |
, 106},
{ -669, 1139, -29},
{ -576, 675, 68},
{ -571, 461, 105},
{ -555, 493, 161},
{ -597, 489, 165},
{ -647, 509, 139},
{ -744, 646, 166},
{ -849, 804, 164},
{ -818, 845, 126},
{ -774, 954, 178},
{ -1011, 1110, 411},
{ -904, 758, 207},
{ -893, 221, -132},
{ -104... | { -712, 571, 122},
{ -696, 778, 19},
{ -667, 736, 137},
{ -591, 602, 77},
{ -566, 506, 118},
{ -577, 475, 109},
{ -638, 498, 49},
{ -801, 615, 105},
{ -906, 934, 180},
{ -929, 842, 102},
{ -844, 729, 173},
{ -991, 934, 267},
{ -984, 662, 135},
{ -948, 236, -47},
... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (ctx, cell_layer, font, data->title, font, NULL, font,
NULL, NULL, false, GTextOverflowModeWordWrap) | ;
}
#endif
static uint16_t prv_get_num_rows(MenuLayer *menu_layer, uint16_t section_index,
void *callback_context) {
ChainingWindowData *data = callback_context;
return data->action_group->num_actions;
}
static int16_t prv_get_cell_height(struct MenuLayer *menu_layer,
... |
ics_fill_rect(ctx, &box);
}
}
// Draw border
if (compare) {
const GRect box = GRect(origin.x + 4*color_index_match - 1, origin.y - 1 + height_offset,
COLOR_BAR_WIDTH + 2, COLOR_BAR_HEIGHT + 2);
graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_draw_rect(ctx... | (124, 40 - 16, 20, 16) | ,
GTextOverflowModeFill, GTextAlignmentLeft, NULL);
}
draw_color_wheel_box(ctx, data);
}
static void main_window_load(Window *window) {
AppData *data = window_get_user_data(s_window);
Layer *window_layer = window_get_root_layer(window);
GRect window_bounds = window_layer->bounds;
/... |
current_state == SmartstrapAttributeStateRequestPending) &&
(new_state == SmartstrapAttributeStateIdle)) {
return pebble_task_get_current() == PebbleTask_KernelBackground;
} else if ((current_state == SmartstrapAttributeStateRequestPending) &&
(new_state == SmartstrapAttributeStateReques... | (&write_mbuf, mbuf_get_data(&attr->mbuf), attr->write_length) | |
/*
* 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_num, resource_id, offset,
result, num_bytes) | != num_bytes) {
free(result);
return NULL;
}
return result;
}
|
update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE);
f->is_tmp = false;
}
// Note: We don't free f->name here because we keep the file metadata
// (including the name, so we can detect hits) in the cache until we
// have to evict it to make room for a new file.
PFS_FD(fd).fd_status =... | kernel_free(node) | ;
node = next;
}
}
// PBL-19098 Refactor this to share code with pfs_create_file_list
void pfs_remove_files(PFSFilenameTestCallback callback) {
mutex_lock_recursive(s_pfs_mutex);
const int file_namelen_offset = FILEHEADER_OFFSET + offsetof(FileHeader, file_namelen);
for (uint16_t pg = 0; pg < s_pfs_page_... |
/backlight.h"
#include "kernel/low_power.h"
#include "services/common/analytics/analytics.h"
#include "services/common/battery/battery_monitor.h"
#include "services/common/new_timer/new_timer.h"
#include "syscall/syscall_internal.h"
#include "system/logging.h"
#include "os/mutex.h"
#include "system/passert.h"
#include... | analytics_inc(ANALYTICS_DEVICE_METRIC_BACKLIGHT_ON_COUNT, AnalyticsClient_System) | ;
}
if (new_brightness <= HALF_BRIGHTNESS && s_current_brightness > HALF_BRIGHTNESS) {
// getting dimmer and have now transitioned past half brightness
analytics_stopwatch_stop(ANALYTICS_APP_METRIC_BACKLIGHT_ON_TIME);
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BACKLIGHT_ON_TIME);
}
backlight... |
distance_m, 1600);
// Get the active calories, should be same as session
workout_service_get_active_kcalories(&active_kcalories);
cl_assert_equal_i(200, active_kcalories);
// Add some time and steps
prv_inc_time(600); /* 10 mins */
prv_inc_steps_and_put_event(1800 /* 180 steps per min * 10 mins */);
//... | cl_assert(workout_service_pause_workout(true)) | ;
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
&bpm, &hr_zone));
cl_assert_equal_i(steps, 20);
cl_assert_equal_i(duration_s, 20);
cl_assert_equal_i(bpm, 80);
prv_inc_time(10);
prv_inc_steps_and_put_event(10);
prv... |
0, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10,... | (&health_data) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_health_activity_summary_card__render_current_above_typical5(void) {
HealthData health_data = {
.step_data = 970,
.step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG) | ;
uint8_t status_register = 0;
do {
status_register = prv_flash_read_next_byte();
} while (status_register & 0x1);
prv_flash_end_cmd();
}
static void prv_flash_write_page(const uint8_t* buffer, uint32_t start_addr, uint16_t buffer_size) {
// Ensure that we're not trying to write more data than a single... |
stributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "apps/system_apps/workout/workout.h"
#include "apps/system_ap... | pfs_init(false /* run filesystem check */) | ;
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Setup content indicator
ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer();
co... |
/*
* 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... | firmware_storage_read_firmware_description(flash_address) | ;
if (!firmware_storage_check_valid_firmware_description(&firmware_description)) {
dbgserial_putstr("Invalid firmware description!");
return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED;
}
if (!check_valid_firmware_crc(
flash_address + sizeof(FirmwareDescription), &firmware_description)) {
dbgseria... |
PBL_ASSERT_TASK(PebbleTask_KernelMain) | ;
if (task == PebbleTask_KernelMain) {
if (s_kernel_main_timer_id != TIMER_INVALID_ID) {
new_timer_delete(s_kernel_main_timer_id);
s_kernel_main_timer_id = TIMER_INVALID_ID;
}
s_kernel_main_event_pending = false;
} else if (task == PebbleTask_App) {
if (s_app_timer_id != TIMER_INVALID_I... | |
phics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi") | );
// SW = 11
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 11);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFF... |
al) {
.service_id = service_id,
.attribute_id = attribute_id,
.mbuf = MBUF_EMPTY
};
list_init(&new_attr->list_node);
mbuf_set_data(&new_attr->mbuf, buffer, buffer_length);
// add the node to our list
mutex_lock(s_attr_list_lock);
s_attr_head = (SmartstrapAttributeInternal *)list_prepend(&s_attr... | {
prv_cancel_transaction(attr);
return SmartstrapResultInvalidArgs;
} | else if (!prv_start_transaction(attr, AttributeTransactionEndWrite)) {
// they didn't call smartstrap_begin_write first
return SmartstrapResultInvalidArgs;
}
}
attr->write_length = write_length;
attr->request_type = type;
attr->timeout_ms = timeout_ms;
smartstrap_connection_kick_monitor();
... |
ngle) (((angle % 360) * TRIG_MAX_ANGLE) / 360)
#define MAX_SCALE 10
typedef enum {
APP_STATE_FILL_NON_AA,
APP_STATE_FILL_AA,
APP_STATE_DRAW_NON_AA_NO_SW,
APP_STATE_DRAW_AA_NO_SW,
APP_STATE_DRAW_NON_AA_SW,
APP_STATE_DRAW_AA_SW,
// Add more above
APP_STATE_NUM_STATES
} AppStateIndex;
typedef struct App... | app_state_get_user_data() | ;
data->moving = !data->moving;
log_state(data);
}
static void click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_BACK, back_handler);
window_single_click_subscribe(BUTTON_ID_UP, up_handler);
window_single_click_subscribe(BUTTON_ID_SELECT, select_handler);
window_single_click_... |
/*
* 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... | BT_DEVICE_ADDRESS_XPLODE(address) | );
BLECharacteristic characteristics[8];
uint8_t num_characteristics =
ble_service_get_characteristics(services[i], characteristics, 8);
if (num_characteristics > 8) {
num_characteristics = 8;
}
for (unsigned int c = 0; c < num_characteristics; ++c) {
Uuid characteristic_... |
/*
* 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... | (emx_resources_get_size(1, id_4) == 4) | ;
buf = 0;
ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4);
ASSERT(buf == 4);
ASSERT(s_read_4_called == 1);
ASSERT(s_size_4_called == 1);
// remove 1 & 3
emx_resources_remove_custom(id_1);
ASSERT(emx_resources_get_size(1, id_1) == 0);
emx_resources_remove_custom(id_3);
ASSERT(emx_re... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | battery_set_fast_charge(false) | ;
}
PebbleEvent event = {
.type = PEBBLE_BATTERY_CONNECTION_EVENT,
.battery_connection = {
.is_connected = s_debounced_is_usb_connected,
}
};
event_put(&event);
}
static bool board_has_chg_fast() {
return BOARD_CONFIG_POWER.chg_fast.gpio != 0;
}
static bool board_has_chg_en() {
return ... |
/*
* 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... | {
GPIOOType_TypeDef otype = (BOARD_CONFIG.power_5v0_options == OptionActiveLowOpenDrain)
? GPIO_OType_OD : GPIO_OType_PP;
gpio_output_init(&BOARD_CONFIG.power_ctl_5v0, otype, GPIO_Speed_50MHz);
} |
if (BOARD_CONFIG.lcd_com.gpio) {
gpio_output_init(&BOARD_CONFIG.lcd_com, GPIO_OType_PP, GPIO_Speed_50MHz);
}
// Set up a SPI bus on SPI2
SPI_InitTypeDef spi_cfg;
SPI_I2S_DeInit(BOARD_CONFIG_DISPLAY.spi);
SPI_StructInit(&spi_cfg);
spi_cfg.SPI_Direction = SPI_Direction_1Line_Tx; // Write-only SPI
s... |
/*
* 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_context_set_stroke_color(ctx, GColorBlack) | ;
graphics_draw_pixel(ctx, GPoint(-5, 15));
}
void outside_x_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, GPoint(15, -5));
}
void outside_nx_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_co... |
SMPairingInfo pairing_2;
memset(&pairing_2, 0x00, sizeof(pairing_2));
pairing_2 = (SMPairingInfo) {
.irk = (SMIdentityResolvingKey) {
.data = {
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x08,
0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x20,
},
},
.identity = (BTDeviceInterna... | (&irk_out, &pairing_1.irk, sizeof(irk_out)) | ;
cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out));
ret = bt_persistent_storage_get_ble_pairing_by_id(id_2, &irk_out, &device_out, NULL /* name */);
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_2.irk, sizeof(irk_out));
cl_assert_equal_m(&device_out, &pairing_2.identity, sizeof(... |
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_nx_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_nx_origin... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r3_no_clip.${BIT_DEPTH_NAME}.pbi") | );
// Radius of 2 - ending point for precomputed edges
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MAX_PRECOMPUTED);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r2_no_clip.${BIT_DEPTH_NAME}.pbi... |
{
.gpio = bus->scl_gpio.gpio,
.gpio_pin = bus->scl_gpio.gpio_pin,
};
gpio_input_init(&in_scl);
InputConfig in_sda = {
.gpio = bus->sda_gpio.gpio,
.gpio_pin = bus->sda_gpio.gpio_pin,
};
gpio_input_init(&in_sda);
}
//! Power up I2C bus power supply
//! Always lock bus and peripheral config ac... | {
recovered = true;
break;
} |
}
if (recovered) {
PBL_LOG(LOG_LEVEL_DEBUG, "I2C Bus %s recovered", slave->bus->name);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "I2C Bus %s still hung after bitbang reset", slave->bus->name);
}
prv_bus_pins_cfg_i2c(slave->bus);
prv_bus_reset(slave->bus);
return recovered;
}
/*--------------------DATA... |
GPoint result = GPointZero;
result = gpoint_scale_by_gsize(point, from, to);
cl_assert_equal_i(result.x, 0);
cl_assert_equal_i(result.y, 0);
}
void test_gtypes__gpoint_scale_by_gsize_to_zero(void) {
GSize from = GSize(10, 20);
GSize to = GSizeZero;
GPoint point = GPoint(10, 10);
GPoint result = GPoint... | cl_assert_equal_i(2, PBL_IF_BW_ELSE(1,2)) | ;
#else
#error "unknown platform"
#endif
}
void test_gtypes__pbl_if_color_else(void) {
#if defined(PLATFORM_TINTIN)
cl_assert_equal_i(2, PBL_IF_COLOR_ELSE(1,2));
#elif defined(PLATFORM_SNOWY)
cl_assert_equal_i(1, PBL_IF_COLOR_ELSE(1,2));
#elif defined(PLATFORM_SPALDING)
cl_assert_equal_i(1, PBL_IF_COLOR_ELSE(1,2... |
576, 168},
{ 848, 568, 72},
{ 1352, 312, -8},
{ 1496, 256, 16},
{ 1440, 80, 0},
{ 1400, 40, -32},
{ 1424, 152, -80},
{ 1304, 320, -128},
{ 1128, 264, -112},
{ 1008, 120, -48},
{ 1176, 104, -8},
{ 968, 112, -200},
{ 1032, 320, -144},
{ 976, 152, 32},
{ 1008, 152, -... | { 1088, 504, 0},
{ 1384, 536, 16},
{ 1424, 424, 40},
{ 1296, 336, 72},
{ 1256, 144, 176},
// 51 seconds
{ 1264, 152, 64},
{ 1160, 168, -16},
{ 960, 232, -56},
{ 856, 208, -8},
{ 1104, 224, 0},
{ 992, 224, -72},
{ 1296, 176, 32},
{ 1000, 104, 104},
{ 1160, 200,... | |
troke_color;
if (grect_contains_point(&src->bounds, &src_ic)) {
// TODO: Optimize further (PBL-15657)
// If src_ic is within the bounds of the source image, do the following performance
// optimization:
// Create a clipping rectangle based on the max distance away from the pivot point
// that the... | src_vector_y.rem < 0 ? (-src_vector_y.rem) >> 3 : 0,
src_vector_y.rem < 0 ? (TRIG_MAX_RATIO + src_vector_y.rem) >> 3 :
(TRIG_MAX_RATIO - src_vector_y.rem) >> 3,
src_vector_y.rem < 0 ? 0 : (src_vector_y.rem) >> 3
};
int32_t thresh = 0;
for (int i... |
const GColor dst_color = get_bitmap_color(dest_bitmap, x, y);
if (tint_color.a != 0) {
GColor actual_color = tint_color;
actual_color.a = src_color.a;
ctx->draw_state.stroke_color = gcolor_alpha_blend(actual_color, dst_color);
break;
}
... |
efined */) {
desc.value = __jerryRefs.get($9);
}
if ($1 /* is_get_defined */) {
desc.get = __jerryRefs.get($10);
}
if ($2 /* is_set_defined */) {
desc.set = __jerryRefs.get($11);
}
if ($3 /* is_writable_defined */) {
desc.writable = Boolean($4 /* is_wr... | jerry_string_to_utf8_char_buffer(str_ref, buffer_p, buffer_size) | ;
jerry_release_value(str_ref);
return len;
}
// FIXME: PBL-43551 Propery CESU-8 => UTF-8 conversion.
jerry_size_t jerry_object_to_string_to_char_buffer(const jerry_value_t object,
jerry_char_t *buffer_p,
jerry_s... |
press or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "applib/event_service_client.h"
#include "services/normal/accessory/smartstrap_attribute.h"
#include "kernel/pbl_malloc.h"
#include "fake_smartstrap_profiles.h"
#i... | (app_smartstrap_attribute_get_service_id(NULL) == 0) | |
onId button_id = e->button.button_id;
const bool watchface_running = app_manager_is_watchface_running();
// trigger the backlight on any button down event
if (e->type == PEBBLE_BUTTON_DOWN_EVENT) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BUTTON_PRESSED_COUNT, AnalyticsClient_System);
if (button_id == BUTT... | (e->kill.task, e->kill.gracefully) | ;
return;
case PEBBLE_SUBSCRIPTION_EVENT:
// App button events depend on this, so this needs to be in the minimal event handler.
event_service_handle_subscription(&e->subscription);
return;
default:
PBL_LOG_VERBOSE("Received an unhandled event (%u)", e->type);
return;
}
}... |
/*
* 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 ((RCC_ClocksStatus.HCLK_Frequency / prescaler) > dev->clock_speed_hz) {
// The desired prescaler is not an integer, so we'll round up so that the clock is never
// faster than the desired frequency.
prescaler++;
} |
// enable clock while we initialize QSPI
qspi_use(dev);
// round the flash size up to the nearest power of 2 and calculate QSPI_FSize
uint32_t fsize_value = ceil_log_two(flash_size) - 1;
PBL_ASSERTN(flash_size == (uint32_t)1 << ceil_log_two(flash_size));
// Init QSPI peripheral
QSPI_InitTypeDef qspi_c... |
,
{ -512, 408, -56},
{ -480, 496, 0},
{ -488, 400, 80},
{ -640, 392, 96},
{ -776, 560, 136},
// 44 seconds
{ -872, 600, 96},
{ -976, 768, -32},
{ -984, 752, 96},
{ -1368, 928, -88},
{ -1112, 768, -104},
{ -976, 792, -88},
{ -1080, 680, -160},
{ -1032, 528, 16},
... | { -384, 352, -128},
{ -280, 432, -104},
{ -360, 400, -64},
{ -576, 536, -56},
{ -712, 384, 0},
{ -896, 424, -40},
{ -1088, 512, -24},
{ -1216, 480, 64},
{ -1536, 704, -64},
{ -1296, 504, -40},
{ -1056, 440, 40},
{ -1192, 384, 32},
{ -984, 232, 136},
{ -760, 192, 5... |
{ -1032, 320, 144},
{ -696, 272, 168},
{ -464, 128, 48},
{ -400, 240, 72},
{ -472, 104, 184},
{ -520, 184, 176},
{ -576, 232, 160},
{ -648, 248, 224},
{ -976, 328, 128},
{ -1056, 312, 32},
{ -1304, 376, -32},
{ -1336, 280, -144},
{ -1304, 408, -112},
{ -1232, 208... |
eChunkPayload
//! header) that the next chunk's payload will start at.
uint32_t offset_bytes;
} OutgoingObject;
typedef enum {
OutboxMsgTypeNone,
OutboxMsgTypeControl,
OutboxMsgTypeChunk
} OutboxMsgType;
// TODO: PBL-35780 make this part of app_state_get_rocky_runtime_context()
SECTION(".rocky_bss") static ... | task_free(obj) | ;
}
static void prv_calc_current_chunk_size(size_t *out_bytes_remaining,
size_t *out_chunk_payload_size) {
OutgoingObject *obj = s_state.out.object_queue;
const size_t bytes_remaining = strlen(obj->data_buffer + obj->offset_bytes) + 1;
*out_bytes_remaining = bytes_remaini... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (ctx, GColorBlack) | ;
__profiler_start();
for (int i = 0; i < ITERATIONS; ++i) {
graphics_draw_text(ctx, TEXT, fonts_get_system_font(FONT_KEY_GOTHIC_14),
bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft,
NULL);
}
__profiler_stop();
APP_LOG(APP_LOG_LEVEL_INFO, "Draw Text");
... |
le != HealthServiceAccessibilityMaskAvailable) {
return 0;
}
// If we are summing, scale the values for the first and last day of the time range. For
// min, max, and avg scaling does not apply.
if (aggregation == HealthAggregationSum) {
prv_adjust_value_boundaries(daily_history.totals, ARRAY_LENGTH(da... | if (!state->cache) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough memory for health cache");
return 0;
} |
HealthValue value = 0;
uint32_t num_samples = 0;
switch (aggregation) {
case HealthAggregationSum:
WTF; // Not supported
break;
case HealthAggregationAvg:
value = 0;
break;
case HealthAggregationMin:
value = INT32_MAX;
break;
case HealthAggregationMax:
... |
{
if (do_not_disturb_is_manually_enabled() ||
prv_is_schedule_active() ||
prv_is_smart_dnd_active()) {
return true;
}
return false;
} |
bool do_not_disturb_is_manually_enabled(void) {
return alerts_preferences_dnd_is_manually_enabled();
}
void do_not_disturb_set_manually_enabled(bool enable) {
const bool is_auto_dnd = prv_is_current_schedule_enabled() ||
do_not_disturb_is_smart_dnd_enabled();
const bool was_active = ... | |
/*
* 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));
}
|
ces[] = {
TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK_MESSENGER,
TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK,
TIMELINE_RESOURCE_NOTIFICATION_MAILBOX,
TIMELINE_RESOURCE_NOTIFICATION_GENERIC,
};
char *titles[] = {
"Angela Tam", "Liron Damir", "Heiko Behrens", "Kevin Conley", "Matt Hungerford",
... | if (has_broadcaster) {
attribute_list_add_cstring(&list, AttributeIdBroadcaster, "ABC");
} |
attribute_list_add_cstring(&list, AttributeIdBody,
"01:45\nJames 3pt Shot: Missed\n"
"03:15 | 22-29\nLeonard Free Throw 2 of 2 (8PTS)");
attribute_list_add_uint32(&list, AttributeIdLastUpdated, now);
TimelineItem *item = timeline_item_create_with_attribut... |
KE_SMALL,GCornerBottomLeft);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL);
graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_ME... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL) | ;
graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersRight);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_right.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL);... |
white, dark_grey, light_grey, transparent)
// Tests 1-bit jazzberry_jam colored palettized PNG loading into gbitmap
// tests covers an old bug in image tooling where 1 color was 2 power 0
// so bitdepth was detected as 0 (incorrectly)
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_1_bit_j... | {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(1bitpalette));
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette)));
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette);
} |
// Tests 2-bit greyscale PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__greyscale_2_bit(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette));
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette)));
cl_assert_equal_i(gbitmap_get_format... |
NY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// SW = 1
setup_test_aa_sw(&ctx, fb, ORIGIN_REC... | (&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT) | |
tx, (uint8_t *)&c, &should_store, &is_invalid);
cl_assert(is_invalid == false);
if (i == 0 || i == len - 1) {
cl_assert(is_complete == true);
cl_assert(should_store == false);
} else {
cl_assert(is_complete == false);
cl_assert(should_store == true);
cl_assert(c == str[i]);
... | (&ctx, (uint8_t *)&c, &should_store, &is_invalid) | ;
cl_assert(is_invalid == false);
if (should_store) {
cl_assert(is_complete == false);
cl_assert(c == str[read_idx++]);
}
if (is_complete) {
cl_assert(should_store == false);
cl_assert(i == write_idx);
break;
}
}
cl_assert(read_idx == strlen(str));
}
|
_S16_3){};
s_radius_outer = (Fixed_S16_3){};
}
void test_graphics_circle__gpoint_from_polar_returns_zero_for_null(void) {
const uint16_t radius = 5;
const GPoint result = gpoint_from_polar_internal(NULL, radius, 0);
cl_assert_equal_gpoint(result, GPointZero);
}
void test_graphics_circle__gpoint_from_polar_ret... | grect_centered_internal(&p1, GSize(2, 2)) | );
p1.x.raw_value += FIXED_S16_3_HALF.raw_value;
cl_assert_equal_grect(GRect(0, -1, 2, 2), grect_centered_internal(&p1, GSize(2, 2)));
// Repeat for an offset center point
GPointPrecise p2 = GPointPreciseFromGPoint(GPoint(5, 5));
// GRectZero + standardize
cl_assert_equal_grect(GRect(5, 5, 0, 0), grect_ce... |
EAR]);
break;
case 'c':
FMT_RECURSE_I18N(time_locale->c_fmt);
_fmt_recurse:
if (!use_i18n && i18nstr) {
cpystr = i18nstr;
i18nstr = NULL;
}
if (i18nstr) {
cpystr = i18n_get(i18nstr, dest_str);
}
length = localized_strftime(dest_... | case 'W':
// Week starting on Monday, like savages
FMT_INTCOPY(prv_week_of_year(t, true), 2, INTFMT_PADZERO);
break;
case 'x':
FMT_RECURSE_I18N(time_locale->x_fmt);
break;
case 'X':
FMT_RECURSE_I18N(time_locale->X_fmt);
break;
case 'y':
... |
if (left == 0) {
goto _out_of_size;
}
// Finish him!!
dest_str[0] = '\0';
return maxsize - left;
_out_of_size:
// Oops we're dead
return 0;
}
size_t strftime(char * restrict s, size_t maxsize, const char* format, const struct tm* tim_p) {
// Pass a NULL locale because firmware strftime is always ... |
field(jerry_get_global_object(), "ctx", ctx);
}
void test_rocky_api_graphics_path2d__initialize(void) {
fake_malloc_set_largest_free_block(~0);
s_log_internal__expected = NULL;
rocky_runtime_context_init();
fake_app_timer_init();
jerry_init(JERRY_INIT_EMPTY);
s_app_window_stack_get_top_window = (Window){... | cl_assert_equal_point(GPoint(0, 1), lc->path.points[0]) | ;
cl_assert_equal_point(GPoint(2, 3), lc->path.points[1]);
cl_assert_equal_point(GPoint(4, 5), lc->path.points[2]);
s_gpath_draw_filled.call_count = 0;
EXECUTE_SCRIPT(
"ctx.moveTo(7, 8);\n"
"ctx.lineTo(9, 10);\n"
"ctx.fill();\n"
);
// still only the first part (before the .moveTo()) as the sec... |
} else {
session->current_token = blob_db_endpoint_send_write(session->db_id,
dirty_item->last_updated,
dirty_item->key,
dirty_item->key_len,
... | list_remove((ListNode *)dirty_item, (ListNode **)&session->dirty_list, NULL) | ;
kernel_free(dirty_item);
if (session->dirty_list) {
prv_send_writeback(session);
} else {
// Check if new records became dirty while syncing the current list
// New records could have been added while we were syncing OR
// the list could be incomplete because we ran out of memory
session->d... |
ng another
// event.
// 2.) The ONLY task that posts events to s_from_kernel_event_queue is the KernelMain task.
// 3.) Whenever KernelMain wants to post an event to itself, it MUST use this queue.
// 4.) The KernelMain task will always service this queue first, before servicing the kernel or from_app queues.
stati... | while (1); |
#endif
reset_due_to_software_failure();
}
return should_context_switch;
}
static bool prv_try_event_put(QueueHandle_t queue, PebbleEvent *event) {
PBL_ASSERTN(queue);
return (xQueueSendToBack(queue, event, milliseconds_to_ticks(3000)) == pdTRUE);
}
static void prv_event_put(QueueHandle_t queue,
... |
-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the ... | RCC_AHB2PeriphResetCmd(ahb2_periphs, DISABLE) | ;
RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE);
RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE);
// The Cortex-M user gui... |
5;
const GPoint result = gpoint_from_polar_internal(NULL, radius, 0);
cl_assert_equal_gpoint(result, GPointZero);
}
void test_graphics_circle__gpoint_from_polar_returns_correct_points(void) {
const uint16_t radius = 5;
GPoint result;
const GPoint origin_center = GPointZero;
// 90 degrees should be (5, 0)... | GSize(2, 2) | |
= can_expire;
} else {
RecentApp app = {
.id = install_id,
.last_activity = cur_time,
.can_expire = can_expire,
};
circular_cache_push(&s_recent_apps.cache, &app);
}
}
mutex_unlock_recursive(s_recent_apps.mutex);
}
#if UNITTEST
void app_install_manager_flush_recent... | if (app_install_get_entry_for_install_id(APP_RECORDS[i].id, entry)) {
// if a false is returned from the function, then stop iterating.
if (cb(entry, data) == false) {
kernel_free(entry);
return;
}
} |
}
// Iterate over AppDB applications
EnumerateData cb_data = {
.cb = cb,
.data = data,
.entry_buf = entry,
};
app_db_enumerate_entries(prv_app_install_enumerate_app_db, &cb_data);
kernel_free(entry);
}
AppInstallId app_install_get_id_for_uuid(const Uuid *uuid) {
if (uuid_is_invalid(uuid) |... |
-------------------------------------------------------------------------------------
void test_kraepelin_algorithm__sleep_tests(void) {
bool success = prv_sample_discovery_init(&s_sleep_sample_discovery_state.common,
SampleFileType_MinuteSamples,
... | for (int i = 0; i < ARRAY_LENGTH(metrics); i++) {
printf("| ---------------------- ");
} |
float weighted_sum = 0.0;
int pass_count = 0;
int fail_count = 0;
SleepFileTestEntry *entry = &test_entry[0];
SleepTestResults *results;
for (int i = 0; i < num_tests; i++, entry++, results++) {
results = &test_results[entry->test_idx];
// Generate the status string
const char *status = prv_s... |
-736},
{ -136, 488, -752},
// 2 seconds
{ -152, 536, -736},
{ -144, 504, -704},
{ -160, 576, -640},
{ -152, 880, -624},
{ 160, 1080, -800},
{ 104, 896, -848},
{ 72, 616, -688},
{ -32, 640, -688},
{ -24, 824, -736},
{ -16, 808, -760},
{ 96, 832, -848},
{ 48, 664, ... | { 1320, -96, 208},
{ 1048, -72, 104},
{ 888, -88, 64},
{ 872, -128, 64},
{ 880, -168, 72},
{ 944, -184, 24},
{ 920, -224, 80},
{ 1216, -320, 16},
// 8 seconds
{ 896, -136, 56},
{ 1208, -136, -136},
{ 1648, -56, -88},
{ 1648, -80, 136},
{ 1160, 48, 104},
{ 896,... | |
/*
* 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(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)) | ;
cl_assert_equal_i(BITS_BETWEEN(0, 11), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_sector_0(void) {
cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_16K... |
/*
* 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... | menu_layer_set_highlight_colors(&data->menu_layer, GColorJaegerGreen, GColorWhite) | ;
menu_layer_set_click_config_onto_window(menu_layer, window);
layer_add_child(&window->layer, menu_layer_get_layer(menu_layer));
}
static void push_window(AppData *data) {
PBL_LOG(LOG_LEVEL_INFO, "PUSHING WINDOW");
Window *window = &data->window;
window_init(window, WINDOW_NAME("Demo Menu"));
window_set_u... |
been received:
dict_write_begin(&s_expected_iter, s_expected_buffer, MAX_SIZE_OUTBOUND);
cl_assert_equal_i(DICT_OK, dict_write_data(&s_expected_iter, TEST_KEY,
(const uint8_t*)TEST_DATA, MAX_DATA_SIZE));
dict_write_end(&s_expected_iter);
}
void test_app_message__cleanup(void) {
app_message_close();
... | prv_call_outbox_sent(AppOutboxStatusSuccess) | ;
prv_process_sent_data();
// Fire the ack timeout after receiving the nack
app_timer_trigger(app_message_ack_timer_id());
cl_assert_equal_b(s_nack_sent_is_called, true);
cl_assert_equal_i(s_out_sent_call_count, 0);
cl_assert_equal_i(s_out_failed_call_count, 1);
cl_assert_equal_i(s_failure_result, APP_M... |
eep_summary_masking_rect, 5);
// This needs to be done after drawing the progress bars or else the progress fill
// overlaps the outline and things look weird
health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR);
}
static void prv_render_icon(GContext *ctx, Layer *base_layer) {
Health... | (GRectZero, sizeof(HealthSleepSummaryCardData)) | |
t_image_bw,
GPoint(27, 40), DEG_TO_TRIGANGLE(45), GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_bw_assign_center_45.Xbit.pbi"));
}
void test_graphics_draw_rotated_bitmap__origin_bw_set(void) {
GContext ctx;
test_graph... | graphics_context_set_fill_color(&ctx, GColorBlue) | ;
graphics_fill_rect(&ctx, &GRect(0, 0, 20, 10));
graphics_draw_rotated_bitmap(&ctx, test_image_color,
GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero);
cl_check(gbitmap_pbi_eq(
&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_color_assign_center_45_transparent... |
ROR, "FS read out of bounds 0x%x", (int)offset);
}
}
// Invalidates s_pfs_page_flags_cache for a given range of bytes. This should be called after the
// contents of the backing-flash are changed so that we re-read the page flags into our cache.
static void prv_invalidate_page_flags_cache(uint32_t offset, uint32_t s... | get_curr_state(start_page, CREATE_STATE_OFFSET, CREATE_STATE_DONE) | );
}
static bool is_delete_complete(uint16_t start_page) {
return (get_curr_state(start_page, DELETE_STATE_OFFSET, DELETE_STATE_DONE));
}
static bool is_tmp_file(uint16_t start_page) {
return (!get_curr_state(start_page, TMP_STATE_OFFSET, TMP_STATE_DONE));
}
static uint32_t compute_pg_header_crc(PageHeader *hdr)... |
35,
.hour = CRON_HOUR_ANY,
.mday = CRON_MDAY_ANY,
.month = CRON_MONTH_ANY,
.may_be_instant = true,
.clock_change_tolerance = 0,
};
CronJob *job = &test_cron;
time_t base = s_2015_nov12_123456_gmt;
prv_set_rtc(base, &s_timezone_gmt);
// 2015 Nov 12, 12:35:00
int32_t target = 1447331700... | cl_assert_equal_i((uintptr_t)job->cb_data, 0) | ;
cl_assert_equal_i(job->cached_execute_time, timestamps[4 - i - 1]);
cl_assert_equal_i(cron_service_get_job_count(), i+1);
}
time_t left = s_2015_nov12_123456_gmt;
for (int i = 0; i < 4; i++) {
fake_rtc_increment_time(timestamps[i] - left);
left = timestamps[i];
cron_service_wakeup();
cl... |
/*
* 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_log_param_v1((BinLogMessage_Param_v1 *)header) | ;
#else
PBL_LOG(LOG_LEVEL_ERROR, "HcLog: received hashed log in unhashed build");
#endif
break;
case BINLOGMSG_VERSION_UNHASHED_V1:
#if PBL_LOGS_HASHED
PBL_LOG(LOG_LEVEL_ERROR, "HcLog: received unhashed log in hashed build");
#else
prv_log_unhashed_v1((BinLogMes... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(id, 2) | ;
debug_db_determine_current_index((uint8_t []) { 0, 1, 2, 255 }, &index, &id);
cl_assert_equal_i(index, 3);
cl_assert_equal_i(id, 3);
}
void test_debug_db__basic(void) {
int index;
uint8_t id;
debug_db_determine_current_index((uint8_t []) { 0, 1, 2, 3 }, &index, &id);
cl_assert_equal_i(index, 0);
cl... |
r);
return true;
}
void test_notification_window__initialize(void) {
fake_app_state_init();
load_system_resources_fixture();
attribute_list_destroy_list(&s_test_data.statics.attr_list);
s_test_data = (NotificationWindowTestData) {};
}
void test_notification_window__cleanup(void) {
}
// Helpers
///////////... | ((unsigned int)down_scrolls) | ;
// On Round we end up drawing outside the visible screen bounds, so let's draw a circle where
// those bounds are to help us visualize each copy of the screen
#if PBL_ROUND
graphics_context_set_fill_color(ctx, GColorBlack);
graphics_fill_radial(ctx, DISP_FRAME, GOvalScaleModeFitCircle, 1, 0, ... |
onst uint32_t busy_timeout_us = 500;
const bool result = qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status,
dev->state->part->status_bit_masks.busy, true /* set */,
busy_timeout_us);
qspi_release(QSPI);
return result ? S_SU... | prv_write_enable(dev) | ;
qspi_indirect_write(dev->qspi, dev->state->part->instructions.page_program, addr, buffer,
bytes_in_page);
qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status,
dev->state->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEOUT);
qspi_release(dev->qspi... |
frame.origin.y);
} else if (cur <= limit_c) {
// zone b - c
return GPoint(frame.origin.x + frame.size.w,
frame.origin.y +
DIV_X(frame.size.h * MULT_X((cur - limit_b), (limit_c - limit_b))));
} else if (cur <= limit_d) {
// zone c - d
return G... | path.points[path.num_points++] = start_outer_point;
// loop through and add all the corners b/w start and end
for (uint16_t i = 0; i < ARRAY_LENGTH(corners); i++) {
if (corners[i] > 0 && corners[i] < current) {
path.points[path.num_points++] = prv_steps_to_point(corners[i], total, outer_bounds);
}
... |
#if PBL_ROUND
static void prv_draw_outer_dots(GContext *ctx, GRect bounds) {
const GRect inset_bounds = grect_inset(bounds, GEdgeInsets(6));
// outer dots placed along inside circumference
const int num_dots = 12;
for (int i = 0; i < num_dots; i++) {
GPoint pos = gpoint_from_polar(inset_bounds, GOvalScal... |
/*
* 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... | (option_menu, &(OptionMenuCallbacks) {
.select = prv_menu_select,
.get_num_rows = prv_menu_get_num_rows,
.draw_row = prv_menu_draw_row,
.unload = prv_menu_unload,
}, option_menu) | ;
const bool animated = true;
app_window_stack_push(&option_menu->window, animated);
}
static void prv_deinit(void) {
}
///////////////////////////
// App boilerplate
///////////////////////////
static void s_main(void) {
prv_init();
app_event_loop();
prv_deinit();
}
const PebbleProcessMd *option_menu_de... |
lSmartstrap);
SmartstrapResult result = prv_do_send(GenericServiceTypeRead, notification_info->service_id,
notification_info->attribute_id, NULL,
s_reserved_read_mbuf, TIMEOUT_MS);
if (result != SmartstrapResultO... | if (service_id <= ReservedServiceMax) {
// This is a reserved service read which we should handle internally
void *data = mbuf_get_data(s_reserved_read_mbuf);
mbuf_free(s_reserved_read_mbuf);
s_reserved_read_mbuf = NULL;
if (service_id == ReservedServiceManagement) {
success = prv_handle_manag... |
return success;
}
static void prv_handle_notification(void) {
// follow-up with a notification info frame
const uint16_t service_id = ReservedServiceManagement;
const uint16_t attribute_id = ManagementServiceAttributeNotificationInfo;
if (s_reserved_read_mbuf) {
// already a read in progress
return... |
reports_buffer);
s_reports_buffer = NULL;
s_is_scanning = false;
if (s_dropped_reports) {
PBL_LOG(LOG_LEVEL_INFO, "LE Scan -- Dropped reports: %" PRIu32, s_dropped_reports);
}
}
}
bt_unlock();
return success;
}
// --------------------------------------------------------------... | bt_unlock() | |
/*
* 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... | prompt_command_is_executing() | )) {
return false;
}
bool should_context_switch = false;
if (LIKELY(c >= 0x20 && c < 127)) {
prompt_context_append_char(&s_prompt_context, c);
} else if (UNLIKELY(c == 0xd)) { // Enter key
system_task_add_callback_from_isr(
prv_execute_command, &s_prompt_context, &should_context_switch);
... |
v_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_reset);
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown);
// The app's recognizer's gesture completes immediately. Only the app's recognizer sees the touch
// events. All recognizers in the chain are reset
e.type =... | (manager.state, RecognizerManagerState_RecognizersTriggered) | ;
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled);
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed);
// A touchdown occurs where no layers a... |
NY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "health_progress.h"
#include "applib/graphics/gpath_builder.h"
#include "system/logging.h"
// Scales a total shape offset to an individual segment offset.
// @par... | (end, amount_traversed + segment->amount_of_total) | |
text_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(-25, 35), GPoint(15, 40));
}
void across_y_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)... | gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer")) | );
layer_set_update_proc(&layer, &clear_layer_update_callback);
layer_render_tree(&layer, &ctx);
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clear")));
#else
cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite));
#en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.