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...
analytics_heartbeat_app_create(&test_uuid)
; int64_t time_interval = 0x10111213; // uint8_t overflow analytics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_LAUNCH_COUNT, 300); uint8_t val8 = analytics_heartbeat_get(heartbeat, ANALYTICS_APP_METRIC_LAUNCH_COUNT); cl_assert(val8 == (uint8_t)0xff); analytics_heartbeat_set(heartbeat, ANALYTICS_AP...
ol has_worker) { } const char *app_custom_get_title(AppInstallId app_id) { return NULL; } void crashed_ui_show_worker_crash(AppInstallId install_id) { } void crashed_ui_show_pebble_reset(void) { } void crashed_ui_show_bluetooth_stuck(void) { } void app_idle_timeout_stop(void) { } void wakeup_popup_window(uint8_...
{ return false; }
layer, &config); } static void prv_alarm_list_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; if (prv_is_add_alarm_cell(cell_index)) { if (!data->can_schedule_alarm) { ...
(&data->window.layer, menu_layer_get_layer(&data->menu_layer))
rtc_get_time()
, .values = { 0, // This ends up overwritten anyway by the current sleep value AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP } }; // Reset all stored data activity_test_reset(false /*reset_settings*/, true /*tracking_on*/, &sleep_history, NULL); // Change int...
/* * 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...
pfs_open(TEST_FILE_A_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(s_test_file_a))
; pfs_write(fd, (uint8_t *)s_test_file_a, sizeof(s_test_file_a)); pfs_close(fd); memset(s_test_file_b, 0, sizeof(s_test_file_b)); fd = pfs_open(TEST_FILE_B_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(s_test_file_b)); pfs_close(fd); fd = pfs_open(TEST_FILE_C_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, ...
/* * 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...
(LOG_LEVEL_INFO, "Notification modified: %s", uuid_string)
; notifications_handle_notification_acted_upon(id); } else if (!has_status_bits) { notification_storage_store(&notification); PBL_LOG(LOG_LEVEL_INFO, "Notification added: %s", uuid_string); notifications_handle_notification_added(id); } timeline_item_free_allocated_buffer(&notification); 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...
_Static_assert(sizeof(time_t) == 4, "Conversion depends on 32bit time_t")
; #endif if (time == 0) { return 0; } // Construct the double in two uint32_t's then reinterpret as double // Using a uint64_t would pull in helper functions for 64bit shifts union { double result; uint32_t representation[2]; } conv; conv.representation[1] = 0; if (time < 0) { // set ...
The checksum byte (comes after the payload in the frame) uint8_t checksum; //! Flag which is set if we find the frame is invalid bool should_drop; } ReadInfo; typedef struct { //! The profile used for the request SmartstrapProfile profile; //! The MBufIterator to read data into MBufIterator mbuf_iter; }...
(prv_read_complete_system_task_cb, context.context_ptr)
; } } static void prv_store_byte(const uint8_t data) { // NOTE: THIS IS RUN WITHIN AN ISR // The checksum byte is the last byte in the frame. This byte could be the last byte we receive // (making it the checksum byte), so we always keep a 1 byte temporary buffer before storing the // byte in the MBuf. This ...
RD_CONFIG.i2c_device_count, "I2C device ID out of bounds %d (max: %d)", device_id, BOARD_CONFIG.i2c_device_count); uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id]; I2cBus *bus = &i2c_buses[bus_idx]; bus_lock(bus); if (bus->user_count == 0) { bus_enable(bus_idx); } bus->user_count++; ...
(bus->i2c, ENABLE)
; bool result = false; do { // Generate start event bus->i2c->CR1 |= I2C_CR1_START; //Enable event and error interrupts bus->i2c->CR2 |= I2C_CR2_ITEVTEN | I2C_CR2_ITERREN; // Wait on semaphore until it is released by interrupt or a timeout occurs if (semaphore_wait(bus)) { if (bus-...
, { 1264, 608, -176}, { 1096, 408, -144}, { 960, 496, -144}, { 1040, 232, -96}, { 1112, 192, -120}, { 1328, 256, -120}, { 1264, 176, -16}, { 1304, 144, -104}, { 1024, -200, 88}, { 1056, -112, 8}, { 760, -24, -80}, { 776, 64, -456}, { 1224, 104, -160}, { 1152, 256,...
{ 1080, 192, -320}, { 1128, 392, -288}, { 1304, 504, -280}, { 1368, 632, -304}, { 1144, 816, -384}, { 912, 1080, -432}, // 26 seconds { 952, 872, -408}, { 1160, 976, -360}, { 1104, 752, -216}, { 1232, 688, -192}, { 1472, 552, -192}, { 1240, 392, -216}, { 1080, 160...
{ 1384, 160, -200}, { 1392, 128, -136}, { 1216, 128, -256}, { 856, -104, -248}, { 464, -200, -72}, { 632, 0, -568}, { 920, -72, -528}, { 1360, 104, -512}, { 960, 56, -440}, { 848, 152, -328}, { 1000, 320, -216}, { 1424, 616, -240}, { 1448, 864, -120}, { 1104, 792...
/* * 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(LOG_LEVEL_ERROR, " %s", msg)
; } task_free(name); task_free(msg); }
ta Test Functions **************/ /***********************************************************/ #define COUNTER_START \ uint32_t _start = *((volatile uint32_t *)0xE0001004);\ uint32_t _tot = 0 #define COUNTER_STOP \ uint32_t _end = *((volatile uint32_t *)0xE0001004) #define COUNTER_PRINT(x) \ ...
(pebble_task_get_current())
; task_watchdog_mask_set(pebble_task_get_current()); } return status; } #endif // CAPABILITY_USE_PARALLEL_FLASH
/* * 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...
( true /* active_scan */, false /* use_white_list_filter */, true /* filter_dups */, 10240, 10240)
/* * 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...
raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 2)
== 3); cl_assert(raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 1) == 1); cl_assert(raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 4) == 12); cl_assert(raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 8) == 192); cl_assert(raw_image_get_value_for_bitdepth(test1, 4, 1, 2, 2) == 3); cl_assert(raw_image_ge...
t16_t label_height = 10; const int16_t small_numbers_height = 30; const int16_t accent_numbers_height = 40; const int16_t large_numbers_height = 40; const int16_t disconnected_text_height = 24; // magic numbers measured from design spec const int16_t distance_column_x_offset = 0; const int16_t distance_c...
GRect(0, disconnected_text_y_offset, background_width, disconnected_text_height)
); prv_setup_text_layer(data->disconnected_text, font_key_disconnected, i18n_get("Disconnected", data), GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(data->disconnected_text)); layer_set_hidden(text_layer_get_layer(data->disconnected_text), true); // Sync setu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
sys_accel_manager_data_unsubscribe(state->manager_state)
; } } // ---------------------------------------------------------------------------------------------- // Event service handler for tap events static void prv_do_shake_handle(PebbleEvent *e, void *context) { PebbleTask task = pebble_task_get_current(); AccelServiceState *state = (AccelServiceState *)accel_serv...
Layer *)swap_layer->current, SWAP_MS, dy, NULL); Animation *next_down = prv_create_anim_frame_scroll((Layer *)swap_layer->next, SWAP_MS, dy, NULL); return animation_spawn_create(prev_down, current_down, ne...
animation_set_curve(next, curve)
; #endif animation = animation_spawn_create(current, next, NULL); } else { animation = current; } swap_layer->animation = animation; animation_schedule(animation); } // scroll to top of current notification static void prv_scroll_to_top(SwapLayer *swap_layer) { int16_t offset = prv_get_current_notifi...
alf(TimelineLayout *pin_timeline_layout, TimelineLayout *card_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon_res_info.res_id); if (!from_reel) { retur...
{ TimelineLayout *layout = context; layer_set_hidden(&layout->icon_layer.layer, false); // Clip for the static icon layer_set_clips(&layout->icon_layer.layer, true); }
void timeline_layout_transition_card_to_pin(TimelineLayout *card_timeline_layout, TimelineLayout *pin_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon_re...
* | / | | \ * |/ | | \ * LIGHT_OFF +-------|-------------------------------------------|---------> * | | * ...
(s_timer_id, LIGHT_FADE_TIME_MS / LIGHT_FADE_STEPS, light_timer_callback, NULL, 0 /* flags */)
; } break; case LIGHT_STATE_OFF: new_brightness = BACKLIGHT_BRIGHTNESS_OFF; new_timer_stop(s_timer_id); break; } if (s_current_brightness != new_brightness) { prv_change_brightness(new_brightness); } } static bool prv_light_allowed(void) { if (!s_backlight_allowed) { ...
/* * 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...
layout_get_colors(layout)
; if (colors) { graphics_context_set_fill_color(ctx, colors->primary_color); } graphics_fill_rect(ctx, &hr_box); } if (size_out) { *size_out = hr_box.size; } } static GTextNode *prv_horizontal_rule_constructor(const LayoutLayer *layout_ref, ...
= DFSDM_Clock_Internal; DFSDM_InitStruct.DFSDM_Input = DFSDM_Input_External; DFSDM_InitStruct.DFSDM_Redirection = DFSDM_Redirection_Disabled; DFSDM_InitStruct.DFSDM_PackingMode = DFSDM_PackingMode_Standard; DFSDM_InitStruct.DFSDM_DataRightShift = right_shift; DFSDM_InitStruct.DFSDM_Offset = 0; DFSDM_InitSt...
if (!this->state->running) { goto unlock; }
prv_dfsdm_disable(this); prv_disable_gpio(this); if (this->mic_power_state_fn) { this->mic_power_state_fn(false); } stop_mode_enable(InhibitorMic); this->state->running = false; PBL_LOG(LOG_LEVEL_DEBUG, "Stopped microphone, dropped samples: %"PRIu32" bytes received: %"PRIu32, this->stat...
| * | * -------+-------- * | * | * x2 | x3 * | * * + center point * - x coordiante mirror line * | y coordinate mirror line * x given offset point * xn mirrored points */ for (unsigned int i=0; i < ARRAY_LENGTH(quadran...
(framebuffer, &ctx->draw_state.clip_box, p, GPoint(edge.integer - 1, progress), weighting, stroke_color, quadrant)
bool result = do_transfer(device_id, false, i2c_device_address, register_address_start, write_size, (uint8_t*)buffer); if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %" PRId8, BOARD_CONFIG.i2c_device_map[device_id]); } return result; } /*------------------------INTERRUPT FUNCTIONS-----------...
{ bus->i2c->CR2 &= ~I2C_CR2_ITBUFEN; bus->transfer.state = TRANSFER_STATE_END_WRITE; break; }
break; case TRANSFER_STATE_END_WRITE: // End transfer after all bytes have been sent should_context_switch = end_transfer_irq(bus, true); break; default: // Abort transfer from invalid state - should never reach here (state machine logic broken) should_context_switch = end...
; // Pass the minute data onto the activity detection logic kalg_activities_update(s_alg_state->k_state, utc_sec, m_rec->base.steps, m_rec->base.vmc, m_rec->base.orientation, m_rec->base.plugged_in, m_rec->resting_calories, m_rec->active_calories, minute_distance_m...
{ // Get the timestamp of the first minute we are returning in the caller's array time_t utc_start = context->utc_start; if (utc_start == 0) { // This is the first record we found if (context->oldest_requested_utc < record_utc) { // The caller requested an old timestamp we don't have. Return the old...
.is_reversed_ppogatt_enabled = ppogatt_emulated_server_wa_enabled(conn_idx) }; } static uint8_t prv_handle_connection_state_read(uint16_t conn_idx, uint8_t response_buf[READ_RESPONSE_BUFFER_SIZE]) { PebblePairingServiceConnectivityStatus status = {}; prv_get_conne...
{ *response_length_out = prv_handle_connection_state_read(conn_idx, response); }
else if (value_handle == s_pps_ctx.att_hdl.gatt_mtu) { *response_length_out = prv_handle_gatt_mtu_read(conn_idx, response); } else if (value_handle == s_pps_ctx.att_hdl.conn_params) { *response_length_out = prv_handle_conn_params_read(conn_idx, response); } else { return false; } return true; } st...
field(now, "getSeconds"); jerry_value_t getMinutes = jerry_get_object_field(now, "getMinutes"); jerry_value_t getHours = jerry_get_object_field(now, "getHours"); jerry_value_t getDate = jerry_get_object_field(now, "getDate"); jerry_value_t result_seconds = jerry_call_function(getSeconds, now, NULL, 0); jerry...
(jerry_get_number_value(result_year), 116.0)
; jerry_release_value(result_year); jerry_release_value(result_month); jerry_release_value(result_date); jerry_release_value(result_hours); jerry_release_value(result_minutes); jerry_release_value(result_seconds); jerry_release_value(getYear); jerry_release_value(getMonth); jerry_release_value(getDat...
>next_sibling; } prev_sibling->next_sibling = layer_to_insert; } layer_to_insert->next_sibling = below_layer; } // Above means lower down in the hierarchy so it gets drawn later, // and as a result the drawn on top of what's below it. void layer_insert_above_sibling(Layer *layer_to_insert, Layer *above_lay...
{ while (node) { if (layer_contains_point(node, &iter_ctx->pos)) { iter_ctx->layer = node; if (!node->first_child && !node->next_sibling) { return false; } iter_ctx->pos = gpoint_sub(iter_ctx->pos, node->bounds.origin); if (!prv_find_layer_containing_point(node->first_child,...
MOCKABLE Layer *layer_find_layer_containing_point(const Layer *node, const GPoint *point) { if (!node || !point) { return NULL; } LayerTouchIteratorCtx iter_ctx = { .pos = *point, }; gpoint_sub(iter_ctx.pos, node->frame.origin); prv_find_layer_containing_point(node, &iter_ctx); return (Layer *)i...
gement/app_manager.h" #include "process_management/worker_manager.h" #include "os/mutex.h" #include "services/common/event_service.h" #include "syscall/syscall_internal.h" #include "syscall/syscall.h" #include "system/logging.h" #include "system/passert.h" #include "FreeRTOS.h" #include "queue.h" #include <string.h> ...
prv_event_service_unsubscribe(&event)
; } } void event_service_system_init(void) { s_plugin_list_mutex = mutex_create(); } void event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback add_subscriber_callback, EventServiceRemoveSubscriberCallback remove_subscriber_callback) { if(s_event_services[type] != NULL) { // an even...
60}, { 696, 40, 104}, { 696, 24, 88}, { 792, -32, 128}, { 1024, -48, 72}, { 1096, 88, -40}, { 1584, -120, 152}, { 1736, -24, 224}, // 70 seconds { 1208, 552, -144}, { 992, 640, -192}, { 880, 352, 152}, { 696, 112, 208}, { 752, 152, 200}, { 864, 208, 256}, { 78...
{ 824, 248, 192}, { 848, 320, 192}, { 768, 336, 128}, { 728, 344, 16}, { 848, 384, -88}, { 1168, 472, -168}, { 1304, 480, -112}, { 1840, 464, -16}, { 1544, 496, -64}, { 1008, 360, -32}, { 1120, 240, 40}, { 1280, 112, 128}, // 76 seconds { 1024, 32, 216}, { 824...
{ 680, -32, 40}, { 808, -80, 104}, { 1120, -48, 8}, { 1064, 0, 0}, { 1672, -64, 88}, { 1464, 216, 0}, { 1048, 536, -384}, { 1272, 416, -96}, { 1032, 328, 104}, { 752, 224, 72}, { 744, 200, 128}, { 768, 288, 56}, { 704, 272, 72}, { 784, 336, -8}, { 928, 400, -...
size_t length; uint8_t packet[0]; } BulkIOPacketCallbackData; static PulseTransferFD s_transfer_fds[MAX_PULSE_FDS]; static void prv_respond_malformed_command(void *cmd, size_t length, const char *message) { uint8_t *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); ...
state->impl->open_proc(cmd->open.data, payload_length, &state->domain_state)
; if (FAILED(ret)) { prv_free_fd(fd); if (ret == E_INVALID_ARGUMENT) { prv_respond_malformed_command(cmd, length, "Invalid domain data"); } else { prv_respond_internal_error(cmd, length, ret); } return; } OpenResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return true; }
static bool semaphore_wait(I2cBus *bus) { bus->busy = true; volatile uint32_t timeout_attempts = I2C_TIMEOUT_ATTEMPTS_MAX; while ((timeout_attempts-- > 0) && (bus->busy)); bus->busy = false; return (timeout_attempts != 0); } static void semaphore_give(I2cBus *bus) { } /*-------------------BUS/PIN CONFIG F...
ic(); uint16_t value_length; GATTBufferedNotificationHeader header = { .characteristic = BLE_CHARACTERISTIC_INVALID, .value_length = 0, }; bool has_more = gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header); ...
(e, BTErrnoOK)
/* * 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...
(RegPwmOut2, brightness)
; write_register(RegPwmOut3, brightness); write_register(RegDataUpdate, 0xaa); i2c_release(I2C_LED); s_backlight_off = (brightness == 0); if (s_backlight_off && s_rgb_current_color == LED_BLACK) { prv_shutdown(true); } } void led_controller_rgb_set_color(uint32_t rgb_color) { if ((BOARD_CONFIG_B...
/* * 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 (status >= 0) { return status; }
int pos = pfs_seek(iter->fd, 0, FSeekCur); PBL_LOG(LOG_LEVEL_ERROR, "Could not read data to %p of length %d at pos %d: %"PRId32, data, data_len, pos, status); fatal_logic_error(iter); } static int sfs_write(SettingsRawIter *iter, const uint8_t *data, int data_len) { status_t status = pfs_write(iter...
ext *)123; // just a fake internal guard != NULL gdraw_command_list_draw(ctx, command_list); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_i(s_circle_fill_count, 0); prv_reset(); free(command_list); com...
(gdraw_command_image_get_data_size(clone), size)
; cl_assert_equal_i(0, memcmp(clone, image, size)); free(clone); free(image); } void test_gdraw_command__draw_image(void) { GDrawCommandImage *image = malloc(sizeof(GDrawCommandImage) + sizeof(GDrawCommand) + (sizeof(GPoint) * 2)); GDrawCommandList *command_list = &image->command_list; *command_list...
e.fd); PBL_ASSERTN(session->storage.write_offset + space_needed <= file_size); } return success; } // ----------------------------------------------------------------------------------------- static bool prv_write_data(DataLoggingSessionStorage *storage, const void *data, uint32_t r...
(session, bytes_read)
< 0) { goto exit; } bytes_to_copy -= bytes_read; } // We successfully transferred the unread data to the new storage, place it into the session // info pfs_close(session->storage.fd); // Close the new file now. That will finish up the swap for us pfs_close(new_storage.fd); new_storage.fd...
h" #include "services/common/bluetooth/bluetooth_ctl.h" #include "services/common/system_task.h" #include "system/hexdump.h" #include "system/logging.h" #include "system/passert.h" #include "system/reset.h" #include "util/assert.h" #include "util/circular_buffer.h" #include "util/crc32.h" #include "util/math.h" #inclu...
periph_config_disable(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, RCC_APB1Periph_TIM6)
ive(void) { return pfs_active_in_region(0, s_pfs_size); } // Scans through the filesystem to see if we rebooted while a file was in the // middle of being created and cleans up these partial files. void pfs_reboot_cleanup(void) { static uint16_t curr_pg = 0; for (; curr_pg < s_pfs_page_count; curr_pg++) { u...
PBL_ASSERTN(list_contains(s_head_callback_node_list, &callback_node->list_node))
; list_remove(&callback_node->list_node, &(s_head_callback_node_list), NULL); // if no one is watching the file anymore, free the string ListNode *find_str = list_find(s_head_callback_node_list, watch_list_find_str, (char *)callback_node->name); if (find_str == NULL) { kernel_free((void *)(callback_n...
layer; KinoReel *reel; GBitmap *approve_bitmap; GBitmap *decline_bitmap; ActionBarLayer action_bar_layer; Layer info_text_mask_layer; PropertyAnimation *info_text_out_animation; PropertyAnimation *info_text_in_animation; // The info text layers store show the text that prompts the user to pair TextLay...
(&data->info_text_layer2, &translations[data->translated_str_idx])
/* * 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...
{ GATT_LOG_DEBUG("gatt_wrapper_read: handle: %d, context_ref: %d, source: %d", handle, context_ref, source); const GattRespDest resp_dest = prv_dest_from_source(source); if (!prv_enqueue(conn_idx, context_ref, resp_dest, GattOpType_Read)) { return BLE_ERROR_NOT_CONNECTED; } ble_error_t r...
ble_error_t gatt_wrapper_read_by_uuid(uint16_t conn_idx, uint16_t start_h, uint16_t end_h, const att_uuid_t *uuid, uintptr_t context_ref, GattReqSource source) { GATT_LOG_DEBUG("gatt_wrapper_read_uuid: context_ref: %d, source: %d", context_...
/* * 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_LEVEL_DEBUG, "App Message Failed to Send!")
; } static void app_message_init(void) { // Register message handlers app_message_register_inbox_received(in_received_handler); app_message_register_inbox_dropped(in_dropped_handler); app_message_register_outbox_failed(out_failed_handler); // Init buffers app_message_open(64, 64); } static void window_loa...
uint8_t stroke_width, GCornerMask quadrant) { prv_stroke_circle_quadrant_full_override_aa(ctx, p, radius, stroke_width, quadrant, true); } #endif // PBL_COLOR //! Draws aliased stroked quadrant of a circle //! @internal T_STATIC void graphics_circle_quadrant_draw_stroked_non_aa(GContext* ctx, GPoi...
{ // Antialiased and Stroke Width == 1 graphics_circle_draw_1px_aa(ctx, p, radius); return; }
} #endif if (ctx->draw_state.stroke_width > 1) { // Non-Antialiased and Stroke Width > 1 graphics_circle_draw_stroked_non_aa(ctx, p, radius, ctx->draw_state.stroke_width); } else { // Non-Antialiased and Stroke Width == 1 graphics_circle_draw_1px_non_aa(ctx, p, radius); } } #if defined(PLATFOR...
item size_t payload_size = timeline_item_get_serialized_payload_size(item); uint8_t *buffer = kernel_malloc_check(sizeof(SerializedTimelineItemHeader) + payload_size); uint8_t *write_ptr = buffer; // serialize the header timeline_item_serialize_header(item, (SerializedTimelineItemHeader *) write_ptr); writ...
{ // Records inserted from the phone are already synced const bool mark_synced = true; return prv_insert_serialized_item(key, key_len, val, val_len, mark_synced); }
int pin_db_get_len(const uint8_t *key, int key_len) { return timeline_item_storage_get_len(&s_pin_db_storage, key, key_len); } status_t pin_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_len) { return timeline_item_storage_read(&s_pin_db_storage, key, key_len, val_out, val_len); } status_t p...
+ attr->string_list->serialized_byte_length + 1; // +1 for null char case AttributeTypeUint32List: return Uint32ListSize(attr->uint32_list->num_values); default: // The rest of the types fit within the Attribute struct return 0; } } static bool prv_deep_copy_attribute(Attribute *dest, const...
{ PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint8 for non-uint8_t attribute"); }
e address or one bonding per intent. BTErrno e; bool registered; BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); // Register connection intent: e = gap_le_connect_connect(&device, ...
(&device, true /* is_master */)
; prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST); } void test_gap_le_connect__connection_event_for_registered_client_by_bonding(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_i...
" #include "process_management/worker_manager.h" #include "resource/resource_ids.auto.h" #include "services/common/analytics/analytics.h" #include "services/common/battery/battery_state.h" #include "services/common/battery/battery_monitor.h" #include "services/common/compositor/compositor.h" #include "services/common/c...
PBL_ASSERTN(success)
; } light_button_pressed(); } else if (e->type == PEBBLE_BUTTON_UP_EVENT) { if (button_id == BUTTON_ID_BACK) { launcher_cancel_force_quit(); } light_button_released(); } app_idle_timeout_refresh(); if (compositor_is_animating()) { // mask the app task if we're already animating ...
f, "There are 10 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*o lights", 3, 8); cl_assert_equal_s(dstbuf, "There are 010 lights"); // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*ozero%.*o", -3, 0, -3, 1); cl_assert_equal_s(dstb...
snprintf(dstbuf, 256, "There are %03X lights, %03X", 16, -4)
; cl_assert_equal_s(dstbuf, "There are 010 lights, FFFFFFFC"); // Space padded minimum character output snprintf(dstbuf, 256, "There are %3X lights, %3X", 16, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, FFFFFFFC"); // Space for positive signed // No signed conversion occurs, so this is a no-op ...
sizeof(advert_terms_b)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job_b); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising...
(s_unscheduled_completed, true)
; // Expect A's fourth term: assert_ad_data("A"); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); gap_le_assert_advertising_interval(advert_terms_a[3].min_interval_slots, advert_terms_a[3].max_interval_slots); regular_timer_fire_seconds(1); // Expect A to be...
(&stored_data.ble_data.pairing_info, &itr_data->pairing_info)
) { itr_data->key_out = key; return false; // stop iterating } return true; } static BTBondingID prv_get_key_for_sm_pairing_info(const SMPairingInfo *pairing_info) { KeyForSMPairingItrData itr_data = { .pairing_info = *pairing_info, .key_out = BT_BONDING_ID_INVALID, }; prv_file_each(prv_get_...
iple_forecasts_exist); data->forecasts_list_head = forecasts_list_head; // Only show the first forecast if the number of forecasts has differed between fetches. // i.e. assume that the same number of forecasts means the locations have remained the same. if (data->forecasts_count != forecasts_count_out)...
(default_forecast)
; // TODO PBL-38484: Consider using a different dialog for when data is stale but phone is connected if (is_default_forecast_data_recent || connection_service_peek_pebble_app_connection()) { const uint32_t splash_screen_timeout_ms = 500; weather_app_splash_screen_push(splash_screen_timeout_ms); } else { ...
fd = FD_INDEX_OFFSET; fd < FD_INDEX_OFFSET+PFS_FD_SET_SIZE; fd++) { if (PFS_FD(fd).fd_status == FD_STATUS_FREE) { *fdp = fd; return (FDAvail); } if (PFS_FD(fd).fd_status == FD_STATUS_UNREFERENCED) { if ((unref == -1) || (PFS_FD(fd).time_closed < curr_time_closed)) { unref = fd; ...
while (bytes_written < size) { size_t bytes_to_write = MIN(free_bytes_in_page(file->curr_page) - pg_offset, size - bytes_written); prv_flash_write(buf + bytes_written, bytes_to_write, prv_page_to_flash_offset(file->curr_page) + AVAIL_BYTES_OFFSET + pg_offset); bytes_written += bytes_to_wri...
res = bytes_written; cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } uint32_t pfs_get_size(void) { // one sector is needed for internal book keeping return s_pfs_size - GC_REGION_SIZE; } void pfs_set_size(uint32_t new_size, bool new_region_erased) { uint32_t prev_size = s_pfs_size; s_pfs...
th(int i, int num_cells) { const TimeSelectionSizeConfig * const config = prv_selection_config(); if (!clock_is_24h_style() && (i == (num_cells - 1))) { return config->ampm_cell_width; } else { return config->cell_width; } } static void prv_update_selection_layer(TimeSelectionWindowData *time_selection...
(time_selection_window, top_layer, range_origin_y, 1, extra_line_offset_y)
/* * 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...
BITS_BETWEEN(0, 0)
> 0); max_loops--; } // Make sure the frame reached the "to" state cl_assert_equal_point(layer.frame.origin, to_r.origin); // ------------------------------------------------------------------------------- // Now, reschedule it prv_advance_by_ms_no_timers(10); prv_clear_handler_histories(); anim...
(h, duration)
; prv_clear_handler_histories(); // Before we run, the context should be non NULL cl_assert(animation_get_context(h) == context); animation_schedule(h); int max_loops = 20; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { prv_fire_animation_ti...
IALOG_TIMER_IRQ_HANDLER) #error "DIALOG_TIMER_IRQ_HANDLER must be defined in the board_*.h file!" #endif void DIALOG_TIMER_IRQ_HANDLER(void *ctx) { dbgserial_putstr("BT Trans TO!"); prv_watchdog_stop(); prv_trigger_core_dump_from_isr(); TIM_ClearITPendingBit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_U...
crc32(CRC32_INIT, &s_spi_transport.status_remote, sizeof(s_spi_transport.status_remote))
l, val_len); } prv_print_stats(&file); printf("Making sure we handle running out of storage gracefully...\n"); memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_...
(&file_original, key, key_len, original_value, original_value_length)
; #define NEW_VALUE "new_value" uint8_t new_value[sizeof(NEW_VALUE)]; int new_value_length = sizeof(NEW_VALUE) - 1; memcpy(new_value, NEW_VALUE, sizeof(NEW_VALUE)); jmp_buf jmp; if (setjmp(jmp)) { // If we end up here, that means we wrote at least after_n_bytes to the // SPI flash. Once we get here,...
/* * 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...
{ LauncherAppGlanceStructured *structured_glance = user_data; LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); KinoReel *charging_indicator_icon = NULL_SAFE_FIELD_ACCESS(settings_glance, cha...
static void prv_battery_icon_node_draw_cb(GContext *ctx, const GRect *rect, UNUSED const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { LauncherAppGlanceStructured *structured_glance = user_data; Lau...
.header.id)); // check rollover behaviour cl_assert(!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_bac...
(uuid_equal(&state.pin.header.id, &s_items[4].header.id))
; // check second cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check done cl_assert(iter_next(&iterator) == false); } static void prv_insert_long_items(void) { cl_assert_equal_i(pin_db_flush(), 0); for (unsigned int i = 0; i < ARRAY_LENGTH(s_long...
ke sure neither inner_seq, a, nor b played cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_ha...
prv_count_handler_entries(&s_stopped_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MIN); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MIN); ...
2C_PMIC_HRM_BUS_HAL = { .i2c = I2C3, .clock_ctrl = RCC_APB1Periph_I2C3, .clock_speed = 400000, .duty_cycle = I2CDutyCycle_2, .ev_irq_channel = I2C3_EV_IRQn, .er_irq_channel = I2C3_ER_IRQn, }; static const I2CBus I2C_PMIC_HRM_BUS = { .state = &I2C_PMIC_HRM_BUS_STATE, .hal = &I2C_PMIC_HRM_BUS_HAL, .scl...
MHZ_TO_HZ(50)
, .auto_polling_interval = 16, .clock_ctrl = RCC_AHB3Periph_QSPI, .cs_gpio = { .gpio = GPIOB, .gpio_pin = GPIO_Pin_6, .gpio_pin_source = GPIO_PinSource6, .gpio_af = GPIO_AF10_QUADSPI, }, .clk_gpio = { .gpio = GPIOB, .gpio_pin = GPIO_Pin_2, .gpio_pin_source = GPIO_PinSource2, .g...
!= None) { // Upon connect and disconnect, reset the cached data: music_update_player_volume_percent(0); // Taking short-cut here, music_update_now_playing already puts NowPlayingChanged event, no // need to put it again by calling music_update_player_name: s_music_ctx.player_name[0] = 0; musi...
(s_music_ctx.mutex)
; const bool has_player_name = (s_music_ctx.player_name[0] != 0); if (player_name_out) { strcpy(player_name_out, s_music_ctx.player_name); } mutex_unlock_recursive(s_music_ctx.mutex); return has_player_name; } bool music_has_now_playing(void) { bool has_now_playing = false; mutex_lock_recursive(s...
DiscoveryState s_activity_sample_discovery_state; // --------------------------------------------------------------------------------------- static bool prv_parse_accel_samples_file(AccelSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (StepFileTestEntry) { .samples = state-...
{ continue; }
// If this is an AlgDlsMinuteData line, get the name if (strcmp(token, "AlgDlsMinuteData") == 0) { PBL_ASSERT(state->test_entry.name[0] == 0, "Unexpected start of new samples"); token = strtok(NULL, "("); // Copy starting from token + 1 to skip the '*' at the front strncpy(state->test...
/* * 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...
{ uint8_t code; char information[]; }
PCMPPacket; enum PCMPCode { PCMPCode_EchoRequest = 1, PCMPCode_EchoReply = 2, PCMPCode_DiscardRequest = 3, PCMPCode_PortClosed = 129, PCMPCode_UnknownCode = 130, }; void pulse_control_message_protocol_on_packet( PulseControlMessageProtocol *this, void *raw_packet, size_t packet_length) { if (packet_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ sys_light_enable(enable); }
ActivitySessionType_Walk, .length_min = length_min, .start_utc = rtc_get_time(), .step_data = { .steps = length_min * 60, .active_kcalories = length_min * 2, .resting_kcalories = length_min / 10, .distance_meters = (length_min * 1000) / 30, }, }; } bool activity_get_sessions(...
{ s_data.notifs_shown++; }
// Helpers static void prv_set_time(const struct tm *input) { struct tm time_tm = *input; time_t utc_sec = mktime(&time_tm); rtc_set_time(utc_sec); s_activity_activation_delay_insight_bitmask = 0; s_activation_time = 0; s_activity_activation_delay_insight_bitmask = 0; } // ==============================...
atic const ProtocolHandler s_supported_protocols[] = { #define REGISTER_PROTOCOL(n, f1, f2) { \ .number = (n), \ .handler = (f1), \ .link_state_handler = (f2) \ }, #include "console/pulse_protocol_registry.def" #undef REGISTER_PROTOCOL }; static TimerID s_keepalive_timer = TIMER_INVALID_ID; static void...
(PULSE_MAX_SEND_SIZE)
+ LINK_HEADER_LEN) { buf_valid = true; } PBL_ASSERT(buf_valid, "Buffer is not from the PULSE transmit buffer pool"); } void pulse_handle_character(char c, bool *should_context_switch) { // TODO: discard a frame outright if a framing error occurs if (s_current_receive_buffer == NULL) { s_current_receiv...
r_events++; s_last_hr_event = e->health_event; } // --------------------------------------------------------------------------------------- // Test that some HRM events aren't passed on from activity service void test_activity__hrm_ignore(void) { int32_t median, total_weight; s_num_hr_events = 0; // Start ac...
activity_metrics_prv_set_metric(ActivityMetricDistanceMeters, Wednesday, 22)
; activity_get_metric(ActivityMetricDistanceMeters, 2, metric_values); cl_assert_equal_i(metric_values[0], 66); cl_assert_equal_i(metric_values[1], 22); cl_assert_equal_i(activity_metrics_prv_get_distance_mm(), 66 * MM_PER_METER); activity_metrics_prv_set_metric(ActivityMetricActiveKCalories, Thursday, 22); ...
h 2015, 12:00:00 (T-7DAY-00:00:00) rtc_set_time(jun10th_noon_2015 - (7 * SECONDS_PER_DAY)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Jun 12, 12:00 PM", time_buf); // June 5th 2015, 12:00:01 (T-7DAY+00:00:01) rtc_set_time(jun10th_noon_2015 ...
(event_time - (11 * SECONDS_PER_HOUR) - 1)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 01:00:00 (T-11:00:00) rtc_set_time(event_time - (11 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELAT...
{ 1416, 640, -16}, { 1848, 632, 8}, { 1824, 528, -56}, { 1832, 424, -8}, { 1880, 392, -16}, { 1824, 408, -200}, { 1576, 336, -336}, { 1160, -56, -312}, { 792, -624, -256}, { 864, -544, -440}, { 1072, -472, -216}, { 1456, 16, -256}, { 1424, 208, -192}, { 1736, 272...
{ 672, -56, -432}, { 952, -120, -288}, { 1264, 136, -376}, { 1368, 120, -256}, { 1768, 184, -264}, { 1912, 368, -296}, { 1792, 488, -248}, { 1560, 528, -216}, { 1392, 600, -72}, { 1424, 480, -152}, { 1376, 440, -72}, { 1272, 640, 40}, { 1264, 928, 224}, { 832, 118...
{ -64, -8, -1072}, { 48, -408, -928}, { -216, -120, -1032}, { 216, -376, -944}, { -16, -184, -1040}, { 8, -256, -1048}, { -64, -168, -1016}, { -56, -232, -920}, { 448, 96, -1080}, { 24, -368, -928}, { -136, -424, -992}, { 56, -184, -1048}, { -72, -248, -1080}, { ...
ect queue upon entering SessionOpen: prv_outbox_try_send_next(); DBG("SessionOpen enter"); } static void prv_session_open__after_exit(void) { DBG("After SessionOpen exit"); prv_cleanup_inbound_reassembly_buffer(); if (s_state.out.object_queue) { // Make sure we'll re-transfer the object from the start ...
if (!prv_is_tuple_valid_reset_complete(tuple)) { // TODO: document this in statechart prv_send_unsupported_protocol_error_and_enter_await_reset_req(PostMessageErrorMalformedResetComplete); return; }
const PostMessageResetCompletePayload *rc = (const PostMessageResetCompletePayload *) tuple->value[0].data; // Check overlap in supported versions if (!prv_is_version_supported(rc)) { // Don't send an error here! The initiating side is supposed have detected the version // incompatibili...
ORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); animation_set_elapsed(an...
(animation, ANIMATION_DURATION_INFINITE)
; animation_set_elapsed(animation, 20); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20); } void test_kino_player__finite_animation_infinite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANI...
from it's callback static void reg_timer_1_callback(void* data) { PBL_LOG(LOG_LEVEL_DEBUG, "STT running reg_timer_1_callback"); if (s_app_data->reg_timers[0].cb != 0) { PBL_LOG(LOG_LEVEL_DEBUG, "STT reg_timer_1_callback rescheduling from callback for every 2 secs. "); regular_timer_add_multisecond_callback...
(s_app_data->timer[timer_idx_0], &expire_ms)
; PBL_ASSERTN(scheduled && expire_ms <= 500); PBL_LOG(LOG_LEVEL_DEBUG, "STT firing in %d ms", (int)expire_ms); } // ================================================================================= void two_timers_menu_cb(int index, void *ctx) { uint32_t zero_flags = 0; uint32_t expire_ms; menu_callback_pre...
t MenuSelectIndexIterator { MenuIterator it; MenuCellSpan selection; bool did_change_selection:1; } MenuSelectIndexIterator; static void prv_menu_layer_iterator_selection_index_callback(MenuIterator *iterator) { MenuSelectIndexIterator *it = (MenuSelectIndexIterator*)iterator; if (!menu_index_compare(&it->it...
if (!reached_second_half_before) { const MenuIndex prev_index = state.menu_layer->selection.index; state.menu_layer->selection = state.menu_layer->animation.new_selection; prv_announce_selection_changed(state.menu_layer, prev_index); }
// this favors robustness over efficiency - the functions might be called multiple times // but instead of keeping track (which is more difficult that it seems) // we simply call them too often prv_menu_layer_update_selection_scroll_position(state.menu_layer, MenuRowAlignCenter, false); prv_menu_la...
(num_ids, 0)
; cl_assert(blob_db_get_dirty_list(BlobDBIdTest) == NULL); // insert one char *key = "key"; char *value = "value"; cl_assert_equal_i(S_SUCCESS, blob_db_insert(BlobDBIdTest, (uint8_t *)key, strlen(key), ...
che.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and ...
{ if (!ctx->config.impl->callbacks.set_state) { return; } const bool next_state = !ctx->enabled; ctx->config.impl->callbacks.set_state(next_state, ctx->config.context); ctx->enabled = next_state; if (ctx->config.set_exit_reason) { app_exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY); } pr...
static void prv_handle_prompt_confirm(ClickRecognizerRef recognizer, void *context) { ActionableDialog *actionable_dialog = context; ActionToggleContext *ctx = actionable_dialog->dialog.callback_context; prv_push_result_dialog(ctx); // Don't destroy the context since it is being reused for the result dialog ...
, 0, 148, 0}, { 0, 0x69, 0, 145, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 144, 0}, // 135: Local time: 2016-03-01 10:20:00 PM { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0...
{ 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 147, 0}, // 240: Local time: 2016-03-02 12:05:00 AM { 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 150, 0}, { 0, 0x18, 34, 150, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 147, 0}, { 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 150, 0}, ...
{ 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 150, 0}, { 0, 0x7d, 0, 146, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7c, 889, 147, 0}, // 300: Local time: 2016-03-02 01:05:00 AM ...
} else { prv_set_nodes(nodes, header, num_nodes); } for (int i = 0; i < num_nodes; i++) { *list_head = (TimelineNode *)list_sorted_add((ListNode *)*list_head, (ListNode *)nodes[i], prv_time_comparator, true); } } static bool prv_each(SettingsFile *file, SettingsRecordInfo *info, void *context) { ...
if (timeline_iter_state->node == NULL) { timeline_iter_state->node = orig; return false; }
} while (!prv_show_event(timeline_iter_state->node, timeline_iter_state->start_time, timeline_iter_state->midnight, timeline_iter_state->direction, timeline_iter_state->show_all_day_events) || !timeline_exists(&timeline_iter_state->node->id)); timeline_item_free_allocated_buffer(&timeline_iter_s...
lied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "services/common/clock.h" #include "services/normal/timezone_database.h" #include "services/normal/filesystem/pfs.h" #include "resource/resource_ids.auto.h" #include "flash_reg...
(jan1st_noon_2005)
; cl_assert_equal_i(rtc_get_time(), jan1st_noon_2005); cl_assert_equal_i(time_utc_to_local(rtc_get_time()), jan1st_noon_2005 + gmtoff); } } void test_clock__basic_timezone_dst(void) { s_prefs_24h_style = false; fake_rtc_init(0, 0); rtc_timezone_clear(); static const time_t jan1st_noon_2005 = 1104580...
36, -104, -1080}, { -120, 72, -992}, { -128, 24, -1016}, { -160, -112, -800}, { -136, 72, -1056}, { -160, -168, -960}, { -144, -64, -1056}, { -160, -176, -1016}, { -168, -72, -944}, { -88, 24, -1136}, { -192, -192, -936}, { -160, -168, -1216}, { -192, -184, -832}, { 0...
{ -160, -120, -992}, { -160, -120, -992}, { -160, -112, -1000}, { -152, -128, -992}, { -160, -128, -1000}, { -160, -128, -992}, { -160, -120, -1000}, { -160, -112, -992}, { -160, -128, -992}, { -152, -128, -992}, { -152, -120, -1000}, { -160, -128, -992}, { -160, -120...
/* * 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...
(num_bytes + (used_aligned ? 7 : 0))
; if (!result || sys_resource_load_range(app_num, resource_id, offset, result, num_bytes) != num_bytes) { free(result); return NULL; } return result; }
/* * 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(array && num)
; size_t i = 0; while (i < *num) { if (array[i] == NULL) { for (size_t j = i + 1; j < *num; j++) { array[j-1] = array[j]; } (*num)--; } else { i++; } } }
OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "settings_raw_iter.h" #include "kernel/pbl_malloc.h" #include "services/normal/filesystem/pfs.h" #include "system/logging.h" #include "system/passert.h" #inclu...
(iter, 0, FSeekSet)
; sfs_read(iter, (uint8_t*)&iter->file_hdr, sizeof(iter->file_hdr)); iter->hdr_pos = -1; iter->resumed_pos = -1; } void settings_raw_iter_write_file_header(SettingsRawIter *iter, SettingsFileHeader *file_hdr) { sfs_seek(iter, 0, FSeekSet); sfs_write(iter, (uint8_t*)file_hdr, sizeof(*file_hdr)); iter->file_h...
health_service_private_weekly_filter(int index, int32_t value, void *tm_weekday_ref) { const int tm_weekday = (int)(uintptr_t)tm_weekday_ref; return (health_service_private_non_zero_filter(index, value, NULL) && (positive_modulo(tm_weekday - index, DAYS_PER_WEEK) == 0)); } // -------------------------------...
(metric, time_start, time_end, HealthAggregationSum, HealthServiceTimeScopeOnce)
/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limit...
while (job && remaining_length) { const size_t job_length = job->impl->get_length(job); const size_t consume_length = MIN(remaining_length, job_length); job->impl->consume(job, consume_length); SessionSendQueueJob *next = (SessionSendQueueJob *)job->node.next; if (job_length == consume_length) { ...
}
/ 10000; zr = (305 * d[i].z + 305 * zp + 9391 * zr) / 10000; xp = d[i].x; yp = d[i].y; zp = d[i].z; x += xr; y += yr; z += zr; } x /= (int)num_samples; y /= (int)num_samples; z /= (int)num_samples; // TODO: could this ever be called in the middle of ecompass_service_handle? // m...
mag_change_sample_rate(MagSampleRate20Hz)
; regular_timer_add_multiminute_callback(&s_cb_info, 2); s_calib_run = true; s_high_freq_calib_active = true; samples_collected = 0; return; // if we are switching to high freq mode, don't use 1st sample } if (samples_collected < 5) { return; // wait a few samples for ramp u...
); break; case ActionResultTypeDoResponse: prv_handle_do_response_response(data); break; default: prv_cleanup_action_result(data, false /* success */); PBL_LOG(LOG_LEVEL_WARNING, "Unknown Action Response"); break; } } static void prv_subscribe_to_action_results_and_timeout...
timeline_invoke_action(pin, action, &response_attributes)
; break; } case TimelineItemActionTypePostpone: { Attribute timestamp_attr = { .id = AttributeIdTimestamp, .uint32 = (uint32_t)(uintptr_t)context, }; AttributeList response_attributes = { .num_attributes = 1, .attributes = &timestamp_attr, }; ...
oid action_bar_raw_up_down_handler(ClickRecognizerRef recognizer, ActionBarLayer *action_bar, bool is_highlighted) { const ButtonId button_id = click_recognizer_get_button_id(recognizer); const uint8_t index = button_id - 1; // is_highlighted will cause the icon in the action bar to render normal or inverted: ...
layer_remove_from_parent(&action_bar->layer)
if (!shared_prf_storage_get_bt_classic_pairing_data(&bd_addr, name, &link_key, &platform_bits)) { // No pairing available, check to see if we have a pairing in the gapDB prv_push_bt_persist_to_shared_prf(BtPersistBondingTypeBTClassic); return; }
bt_persistent_storage_store_bt_classic_pairing(&bd_addr, &link_key, name, &platform_bits); } static void prv_load_ble_pairing_from_prf(void) { SMPairingInfo prf_pairing_info; char device_name[BT_DEVICE_NAME_BUFFER_SIZE]; bool requires_address_pinning; uint8_t flags; if (!shared_prf_storage_get_ble_pairin...
/* * 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...
(&char_iter)
); cl_assert(!iter_next(&char_iter)); } void test_char_iterator__decode_test_string_with_formatting_char(void) { Iterator char_iter; CharIterState char_iter_state; Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_state; // Skip over codepoints that aren't newline and < 0x20 boo...
ion, &reg_value, 1); // set the desired bits reg_value = (reg_value & ~mask) | value; // enable writing and write the register value prv_write_cmd_no_addr(dev, dev->state->part->instructions.write_enable); qspi_indirect_write_no_addr(dev->qspi, write_instruction, &reg_value, 1); qspi_release(dev->qspi); ...
memcmp(buffer_dma, buffer_mmap, size)
!= 0) { prompt_send_response("FAILURE: buffer_dma != buffer_mmap"); success = false; } const int buf_size = 64; char buf[buf_size]; prompt_send_response_fmt(buf, buf_size, "Size: %d DMA: %"PRIu32 " POL: %"PRIu32 " MMP: %"PRIu32, size, dma_time, pol_time, mmap_time); kern...
_equal(&store->uuid, uuid); } static PersistStore * prv_find_open_store(const Uuid *uuid) { return (PersistStore *)list_find(s_client_stores, prv_uuid_list_filter, (void *)uuid); } static ALWAYS_INLINE void prv_lock(void) { mutex_lock_with_lr(s_mutex, (uint32_t)__builtin_ret...
(s_client_stores, &store->list_node)
; } } prv_unlock(); } // Release the store for the given UUID. Called by ProcessManager to clean up // after a task exists. If there are no other processes using the same store, it // will be freed void persist_service_client_close(const Uuid *uuid) { prv_lock(); { PersistStore *store = prv_find_open_s...
ALOG_SPI_TX_DMA_REQUEST }; SPISlavePort * const DIALOG_SPI = &DIALOG_SPI_SLAVE_PORT; // // iCE40LP configuration // static ICE40LPDeviceState s_ice40lp_state; static ICE40LPDevice ICE40LP_DEVICE = { .state = &s_ice40lp_state, .spi_port = &ICE40LP_SPI_SLAVE_PORT, .base_spi_frequency = MHZ_TO_HZ(16), .fast_sp...
(QSPI, BOARD_NOR_FLASH_SIZE)
; }
on_to; layer_get_global_frame(&pin_timeline_layout->icon_layer.layer, &icon_from); layer_get_global_frame(&card_timeline_layout->icon_layer.layer, &icon_to); // Unclip for the scaling animation layer_set_clips(&pin_timeline_layout->icon_layer.layer, false); layer_set_clips(&card_timeline_layout->icon_layer.la...
prv_change_reel(layout, new_reel)
; if (!layout->is_being_destroyed) { // PBL-20111: Continue where we left off until kino reel transform frames is refactored // This is because continuing to render with the transform will have resulted in a jump // since it has been animating in global coordinates, not accounting for the property layer ...
{ if (reel && reel->impl->get_gdraw_command_list) { return reel->impl->get_gdraw_command_list(reel); } return NULL; }
GDrawCommandSequence *kino_reel_get_gdraw_command_sequence(KinoReel *reel) { if (reel && reel->impl->get_gdraw_command_sequence) { return reel->impl->get_gdraw_command_sequence(reel); } return NULL; } GBitmap *kino_reel_get_gbitmap(KinoReel *reel) { if (reel && reel->impl->get_gbitmap) { return reel...
s.background = dialog->window.background_color, }); } } dialog_load(dialog); } static void prv_expandable_dialog_appear(Window *window) { ExpandableDialog *expandable_dialog = window_get_user_data(window); Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); scroll_layer_update_conten...
{ expandable_dialog->header[0] = 0; return; }
strncpy(expandable_dialog->header, header, DIALOG_MAX_HEADER_LEN); expandable_dialog->header[DIALOG_MAX_HEADER_LEN] = '\0'; } void expandable_dialog_set_header_font(ExpandableDialog *expandable_dialog, GFont header_font) { expandable_dialog->header_font = header_font; } void expandable_dialog_set_select_action...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ periph_config_enable(FLASH_SPI, FLASH_SPI_CLOCK); }
void disable_flash_spi_clock(void) { periph_config_disable(FLASH_SPI, FLASH_SPI_CLOCK); } // IMPORTANT: This method is also used by the core dump logic in order to re-initialize the flash hardware // to prepare for writing the core dump. For this reason, it can NOT use any FreeRTOS functions, mess with // the inte...
on_configs[runtime_platform_default_size]; } // FROM selection layer callbacks static char* prv_handle_from_get_text(unsigned index, void *context) { TimeRangeSelectionWindowData *data = context; return date_time_selection_get_text(&data->from, index, data->buf); } static void prv_handle_from_complete(void *conte...
selection_layer_set_callbacks(from_selection_layer, time_range_selection_window, (SelectionLayerCallbacks) { .get_cell_text = prv_handle_from_get_text, .complete = prv_handle_from_complete, .increment = prv_handle_from_inc, .decrement = prv_handle_from_dec, })
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ case LineDirection_Horizontal: APP_LOG(APP_LOG_LEVEL_INFO, "Horizontal lines"); start = GPoint(bounds.origin.x, bounds.size.h / 2); end = GPoint(bounds.size.w, bounds.size.h / 2); break; case LineDirection_Vertical: APP_LOG(APP_LOG_LEVEL_INFO, "Vertical lines"); start = GPo...
t use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR C...
circular_buffer_consume(&s_isr_log_buffer, read_length)
; } portEXIT_CRITICAL(); return result; } static void prv_event_cb(void *data) { while (true) { // No need to worry about reading a partial message here, we write messages to the circular // buffer while disabling interrupts the whole time. uint32_t log_length; if (!prv_isr_buffer_read_and_...
, "Health DB doesn't store an average for metric %d", metric); return false; } SettingsFile file; if (prv_file_open_and_lock(&file) != S_SUCCESS) { return false; } char key[HEALTH_DB_MAX_KEY_LEN]; snprintf(key, HEALTH_DB_MAX_KEY_LEN, "average%s", (metric == ActivityMetricStepCount) ? ST...
settings_file_get(&file, key, key_len, value_out, value_out_len)
; prv_file_close_and_unlock(&file); return rv; } status_t health_db_delete(const uint8_t *key, int key_len) { if (!prv_key_is_valid(key, key_len)) { return E_INVALID_ARGUMENT; } SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUCCESS) { return rv; } rv = settin...