prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
s met before continuing without locking. static void prv_heap_lock(void* unused) { PBL_ASSERT_TASK(PebbleTask_App); } void prv_dump_start_app_info(const PebbleProcessMd *app_md) { char *app_type = ""; switch (process_metadata_get_app_sdk_type(app_md)) { case ProcessAppSDKType_System: app_type = "system...
{ /* PBL-40376: Temp hack: put .rocky_bss at end of APP_RAM: Interim solution until all statics are removed from applib & jerry. These statics are only used for rocky apps, so it's OK that this overlaps/overlays with the app heap for non-rocky apps. */ extern char __ROCKY_BSS_size__[];...
#endif memset((char *)app_ram.start + stack_guard_size, 0, memory_segment_get_size(&app_ram) - stack_guard_size); MemorySegment app_segment; PBL_ASSERTN(memory_segment_split(&app_ram, &app_segment, app_segment_size)); PBL_ASSERTN(memory_segment_split(&app_segment, NULL, stack_guard_size)); // No (...
- Sharp SPI TX // DMA Requests static DMARequestState s_dbg_uart_dma_request_state; static DMARequest DBG_UART_RX_DMA_REQUEST = { .state = &s_dbg_uart_dma_request_state, .stream = &DMA1_STREAM1_DEVICE, .channel = 4, .irq_priority = 0, // no interrupts .priority = DMARequestPriority_High, .type = DMAReque...
IRQ_MAP(I2C1_EV, i2c_hal_event_irq_handler, &I2C_MAIN_BUS)
; IRQ_MAP(I2C1_ER, i2c_hal_error_irq_handler, &I2C_MAIN_BUS); IRQ_MAP(I2C2_EV, i2c_hal_event_irq_handler, &I2C_2V5_BUS); IRQ_MAP(I2C2_ER, i2c_hal_error_irq_handler, &I2C_2V5_BUS); // VOLTAGE MONITOR DEVICES static const VoltageMonitorDevice VOLTAGE_MONITOR_ALS_DEVICE = { .adc = ADC2, .adc_channel = ADC_Channel_12...
(window, false)
; app_event_loop(); return 0; } static void prv_event_loop(void) { Window *window = app_window_stack_get_top_window(); if (window && window->is_render_scheduled) { GContext *ctx = rocky_api_graphics_get_gcontext(); layer_render_tree(&window->layer, ctx); window->is_render_scheduled = false; EM_...
ze_t alloc_size = attributes_actions_get_required_buffer_size(num_attributes, num_actions, attributes_per_action, required_size_for_strings); uint8_t *buffer = task_zalloc(a...
(&item->attr_list, &item->action_group)
; } bool timeline_item_deserialize_item(TimelineItem *item_out, const SerializedTimelineItemHeader* header, const uint8_t *payload) { // If the creation / deserialization fails we need to clean up, and if the item contains garbage // data we w...
{ if (key_len != UUID_SIZE) { return E_INVALID_ARGUMENT; } status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } rv = settings_file_delete(&s_contacts_db.settings_file, key, key_len); prv_close_file_and_unlock_mutex(); return rv; }
status_t contacts_db_flush(void) { mutex_lock(s_contacts_db.mutex); status_t rv = pfs_remove(SETTINGS_FILE_NAME); mutex_unlock(s_contacts_db.mutex); return rv; }
tem_create_with_attributes(timestamp, MINUTES_PER_HOUR, TimelineItemTypePin, LayoutIdGeneric, &list, NULL); attribute_list_destroy_list(&list); } timeline_peek_set_item(item, timestamp >= now, config ? config->num_co...
{ prv_render_timeline_peek(&(TimelinePeekItemConfig) { .timestamp = rtc_get_time() + (5 * SECONDS_PER_MINUTE), .title = "Stock for party 🍺", .subtitle = "Pebble Pad on Park", .icon = TIMELINE_RESOURCE_NOTIFICATION_REMINDER, .num_concurrent = 2, }); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_...
// Visibility Tests ////////////////////// void test_timeline_peek__peek_visibility(void) { prv_set_timeline_item(NULL, false /* animated */); TimelinePeek *peek = timeline_peek_get_peek(); const Layer *layer = &peek->layout_layer; // Normally it is animated, but for this unit test, we don't request `animate...
/* * 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_check_timer_enabled()
) { periph_config_enable(TIM4, RCC_APB1Periph_TIM4); TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE); TIM_Cmd(TIM4, ENABLE); // Prevent us from entering stop mode (and disabling the clock timer) stop_mode_disable(InhibitorButton); } __enable_irq(); } static void prv_button_interrupt_handler(bool *sh...
ith the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express ...
{ return s_kernel_event_queue; }
/* * 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...
(PEEK_TIMEOUT_MS, prv_peek_timeout_callback, NULL)
; } else { app_timer_reschedule(config->peek_timer, PEEK_TIMEOUT_MS); } return (0); } int compass_service_set_heading_filter(CompassHeading filter) { if ((filter < 0) || (filter > (TRIG_MAX_ANGLE / 2))) { return (-1); } CompassServiceConfig *config = *prv_get_config(PebbleTask_Unknown); config-...
, "\nMasks are fun!"); GTextAttributes *text_attributes = graphics_text_attributes_create(); const uint8_t inset = 4; graphics_text_attributes_enable_screen_text_flow(text_attributes, inset); graphics_draw_text(ctx, text, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD), *layer_bounds, GTextO...
app_timer_register(ANIMATION_TARGET_FRAME_INTERVAL_MS, prv_refresh_timer_callback, data)
; } static void handle_init(void) { GDrawMaskDemoData *data = app_zalloc_check(sizeof(*data)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("GDrawMask Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers){ .l...
e && succeeded) { prv_pop_notification_window(window_data); } } static void prv_dismiss_all(void *data, ActionMenu *action_menu) { NotificationWindowData *window_data = (NotificationWindowData*) data; const int num_notifications = notifications_presented_list_count(); if (num_notifications == 0) { ret...
(spawn, anim_handlers, data)
/* * 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...
{ intptr_t address = str_to_address(address_str); if (address == -1) { return; } // Simple sanity check: if (((Layer *)address)->window != app_window_stack_get_top_window()) { dbgserial_putstr("Specify valid Layer address!"); return; } s_nudge_layer = (Layer *)address; dbgserial_putstr("Lay...
_create(); s_notification_window_data.pop_timer_id = EVENTED_TIMER_INVALID_ID; } ////////////////// // Event Handers ////////////////// static void prv_handle_action_result(PebbleSysNotificationActionResult *action_result) { if (action_result->type != ActionResultTypeSuccess && action_result->type != Actio...
{ NotificationWindowData *data = &s_notification_window_data; // We only need to reload from flash if the item is already in memory // (ie. the current item or the next/peek item) if (data->is_modal && prv_is_item_loaded(id)) { prv_reload_swap_layer(data); } }
void notification_window_handle_reminder(PebbleReminderEvent *e) { switch (e->type) { case ReminderTriggered: prv_handle_notification_added_common(e->reminder_id, NotificationReminder); break; case ReminderRemoved: prv_handle_notification_removed_common(e->reminder_id, NotificationReminder...
License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *...
{ PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, " BFARVALID = yes 0x%"PRIx32, SCB->BFAR); }
print_set_indexes(buffer, &bfsr, bfsr_mappings, ARRAY_LENGTH(bfsr_mappings)); } // Memory Management Fault Status Register const uint8_t mmfsr = cfsr & 0xff; static const IndexToName mmfsr_mappings[] = { { 4, "MSTKERR" }, { 3, "MUNSTKERR" }, { 1, "DACCVIOL" }, { 0, "IACCVIOL" } }; if ...
\ ((y>>1 & 1) * xtime(x)) ^ \ ((y>>2 & 1) * xtime(xtime(x))) ^ \ ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \ ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \ #endif // MixColumns function mixes the columns of the state matrix. // The method used to...
InvCipher()
; } #endif // #if defined(ECB) && ECB #if defined(CBC) && CBC static void XorWithIv(uint8_t* buf) { uint8_t i; for(i = 0; i < KEYLEN; ++i) { buf[i] ^= Iv[i]; } } void AES128_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv) { uintptr_t i;...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_nxny.${...
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } #define BOX_SIZE 8 #define CLIP_RECT_DRAW_BOX GRect(10, 10, 140, 30) #define CLIP_RECT_CLIP_BOX GRect(10, 10, 120, 2*BOX_SIZE + 4) #define CLIP_RECT_RECT_BOX GRect(0, 0, BOX_SIZE, BOX_SIZE) #define CLIP_...
/* * 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_string_for_cmd(clock_cmd)
) PERIPH_CONFIG_LOG("Enabling clock %s", prv_string_for_cmd(clock_cmd)); #endif clock_cmd(rcc_bit, ENABLE); } void periph_config_disable(void *periph, uint32_t rcc_bit) { ClockCmd clock_cmd = prv_get_clock_cmd((uintptr_t)periph); #if PERIPH_CONFIG_DEBUG if (prv_string_for_cmd(clock_cmd)) PERIPH_CONFIG_LO...
/* * 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(!iter_next(&utf8_iter))
#include "drivers/periph_config.h" #include "util/delay.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_qspi.h" #define MX25U_FASTREAD_DUMMYCYCLES 4 typedef enum MX25UCommand { // SPI/QSPI Commands MX25UCommand_FastRead = 0x0B, // FAST_READ MX25UCommand_QSPIEnable = 0x35, // QPI MX25UComman...
QSPI_StructInit(&qspi_config)
; qspi_config.QSPI_SShift = QSPI_SShift_HalfCycleShift; qspi_config.QSPI_Prescaler = 0x0; qspi_config.QSPI_CKMode = QSPI_CKMode_Mode0; qspi_config.QSPI_CSHTime = QSPI_CSHTime_1Cycle; qspi_config.QSPI_FSize = 22; // 2^23 = 8MB. -> 23 - 1 = 22 qspi_config.QSPI_FSelect = QSPI_FSelect_1; qspi_config.QSPI_DFla...
=================== // Notification stubs void notification_storage_store(TimelineItem* notification) { 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_ins...
(fake_kernel_services_notifications_ancs_notifications_count(), 0)
; // Make sure we do not trigger, the insights are disabled s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 2 * SECONDS_PER_HOUR; activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(fake_kernel_servi...
); clock_copy_time_string_timestamp(buffer, size, t); } static size_t prv_format_time(char *buffer, int buf_size, const char *format, time_t timestamp) { struct tm time_tm; localtime_r(&timestamp, &time_tm); const size_t ret_val = strftime(buffer, buf_size, i18n_get(format, buffer), &time_tm); i18n_free(form...
if (time_util_get_midnight_of(end_time) == current_day) { // last day of multiday event prv_copy_relative_time_string(number_buffer, number_buffer_size, word_buffer, word_buffer_size, end_time, end_time); } else { // middle day of non-all day multiday event prv_get_relative_all_day_string(word...
//////// #include "stubs_bt_lock.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_analytics.h" void comm_session_analytics_inc_bytes_sent(CommSession *session, uint16_t length) { } // Fakes /////////////////////////////////////////////////////////// #include "fake_kernel_malloc.h" #include "...
cl_assert_equal_p(write_sb2, NULL)
; prv_cleanup_send_buffer(write_sb); } void test_session_send_buffer__multiple_smaller_messages(void) { s_valid_session = &s_session; // This length excludes the sizeof(PebbleProtocolHeader). size_t bytes_free = comm_session_send_buffer_get_max_payload_length(&s_session); bytes_free += sizeof(PebbleProtoco...
}}; char name_2[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 2"; uint8_t platform_bits_2 = 0x22; BTBondingID id_2 = bt_persistent_storage_store_bt_classic_pairing(&addr_2, &link_key_2, name_2, &platform_bits_2); cl_assert(id_2 != BT_BONDING_ID_INVALID); re...
(&addr_2, &link_key_2, name_2, &platform_bits_2)
; cl_assert(id_2 != BT_BONDING_ID_INVALID); // BLE pairing 1 SMPairingInfo pairing_1 = (SMPairingInfo) { .irk = (SMIdentityResolvingKey) {{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00 }}, .identity = (BTDeviceInternal) { .address = ...
e don't have already if (s_test_alg_state.minute_data.sleep_current_container_idx < 0) { cl_assert(s_test_alg_state.minute_data.num_sessions_created < TEST_ACTIVITY_MAX_SESSIONS); s_test_alg_state.minute_data.sleep_current_container_idx = s_test_alg_state.minute_data.num_sessio...
{ return false; }
bool activity_algorithm_minute_file_info(bool compact_first, uint32_t *num_records, uint32_t *data_bytes, uint32_t *minutes) { *num_records = 0; *data_bytes = 0; *minutes = 0; return true; } bool activity_algorithm_test_fill_minute_file(void) { return true; } // We...
_GLOBAL_EQUALS_S("t", "object"); // ...which also has a method .on() EXECUTE_SCRIPT("var t = typeof _rocky.on"); ASSERT_JS_GLOBAL_EQUALS_S("t", "function"); /// ...which is an alias of .addEventListener() EXECUTE_SCRIPT("var a = (_rocky.on === _rocky.addEventListener);"); ASSERT_JS_GLOBAL_EQUALS_B("a", tr...
cl_assert_equal_b(true, rocky_global_has_event_handlers("b"))
; jerry_value_t a_event = rocky_global_create_event("a"); rocky_global_call_event_handlers(a_event); cl_assert_equal_i(1, s_prv_listener_a1__callcount); cl_assert_equal_i(1, s_prv_listener_a2__callcount); cl_assert_equal_i(0, s_prv_listener_b__callcount); jerry_release_value(a_event); jerry_value_t b_ev...
/* * 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(e->type, PEBBLE_APP_OUTBOX_SENT_EVENT); cl_assert(e->app_outbox_sent.sent_handler); e->app_outbox_sent.sent_handler(e->app_outbox_sent.status, e->app_outbox_sent.cb_ctx); ++s_num_app_outbox_events_sent; return true; }
void app_message_outbox_handle_app_outbox_message_sent(AppOutboxStatus status, void *cb_ctx) { } //////////////////////////////////////////////////////////////////////////////////////////////////// // Helpers static int s_num_message_handler_calls; static AppOutboxMessage *s_last_message; static void prv_message_ha...
ate_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { g...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_across_nxny_offset_layer.${BIT_DEPTH_NAME}.pbi")
); #endif setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_WIDTH); graphics_draw_line(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_same_point_offset_layer.${BIT_DEPTH_NAME}.pbi")); } #define COLOR_START_POINT GPoint(5, 35)...
/* * 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; }
RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, TINTIN_METADATA.version_timestamp); } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_detail_card__render_no_calories(void) { HealthData health_data = { .current_calories = 0, }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_heal...
/* * 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, "Executing teardown handler for %d", (int)animation)
layer_a; e.type = TouchEvent_Touchdown; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {4, 0, 1}, 3, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersAct...
(r[0], &layer_a.recognizer_list)
; recognizer_add_to_list(r[1], &layer_a.recognizer_list); recognizer_set_manager(r[0], &manager); recognizer_set_manager(r[1], &manager); r[0]->state = RecognizerState_Failed; recognizer_manager_handle_state_change(&manager, r[0]); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive)...
/* * 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...
printf("SP=0x%08" PRIx32 "\n", (uint32_t) g_stacked_regs)
; // Stack Pointer reset_due_to_software_failure(); } static bool prv_handle_hardfault_due_to_bkpt(void) { // Note: assumes Thumb2! const uint16_t instr = *(const uint16_t *)g_stacked_regs[Stacked_Register_PC]; const uint16_t bkpt_instruction_opcode = 0xbe; if ((instr >> 8) != bkpt_instruction_opcode) { ...
pen_session(CommSession *session) { } void comm_session_analytics_close_session(CommSession *session, CommSessionCloseReason reason) { } void comm_session_receive_router_cleanup(CommSession *session) { } void comm_session_send_queue_cleanup(CommSession *session) { } void bt_persistent_storage_set_cached_system_capa...
{ const uint16_t endpoint_id = 1234; uint8_t data[] = {1, 2, 3, 4}; cl_assert_equal_b(comm_session_send_data(NULL, endpoint_id, data, sizeof(data), COMM_SESSION_DEFAULT_TIMEOUT), false); }
void test_session__basic_open_close(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationSystem); cl_assert(session); cl_assert_equal_b(comm_session_is_valid(session), tru...
est_key; uint32_t newest_key; time_t oldest_valid_utc; time_t newest_valid_utc; } AlgLogMinuteFileContext; static bool prv_log_minute_file_minutes_cb(SettingsFile *file, SettingsRecordInfo *info, void *context_param) { AlgLogMinuteFileContext *context = (AlgLogMinut...
{ ACTIVITY_LOG_DEBUG("Dropping key %"PRIu32", invalid version of %"PRIu16"", key, val->hdr.version); return false; }
if (key < context->oldest_valid_key || key > context->newest_valid_key) { ACTIVITY_LOG_DEBUG("Dropping key %"PRIu32", record UTC of %"PRIu32"", key, val->hdr.time_utc); return false; } // This can take a while, so periodically tickle the KernelBG watchdog. if (context->watchdog...
/* * 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_WARNING, "Invalid pp_ble_control_protocol_msg_callback message: %d", length); return; }
const uint8_t opcode = *(const uint8_t *) data; switch (opcode) { case 0 ... 3: PBL_LOG(LOG_LEVEL_INFO, "Deprecated & unsupported opcode: %u", opcode); break; case BLEControlCommandTypeSetDiscoverablePairable: { BLEControlCommandSetDiscoverablePairable *cmd_data = (BLEControlC...
on the line. delay_us(200); return result; } bool pmic_enable_battery_measure(void) { prv_mon_config_lock(); return prv_set_mon_config(&MON_CONFIG[PMIC_MON_CONFIG_VBAT_INDEX]); // Don't prv_unlock, we don't want anyone else mucking with the mon config until // pmic_disable_battery_measure is called. } ...
prv_log_status_registers("PMIC charge/connection status changed")
; } PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = is_connected, } }; event_put(&event); } static void prv_handle_pmic_interrupt(void *data) { prv_clear_any_pending_interrupts(); ++s_interrupt_bounce_count; new_timer_start(s_de...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(RTC_BKP_FLASH_ERASE_PROGRESS, reg)
; return S_SUCCESS; } status_t flash_impl_clear_nvram_erase_status(void) { RTC_WriteBackupRegister(RTC_BKP_FLASH_ERASE_PROGRESS, 0); return S_SUCCESS; } status_t flash_impl_get_nvram_erase_status(bool *is_subsector, FlashAddress *addr) { uint32_t reg = RTC_ReadBackup...
/* * 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_b(false, rocky_global_has_event_handlers("minutechange"))
; cl_assert_equal_b(false, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(false, rocky_global_has_event_handlers("daychange")); EXECUTE_SCRIPT("_rocky.on('daychange', function() {});"); cl_assert_equal_b(false, rocky_global_has_event_handlers("secondchange")); cl_assert_equal_b(false, rock...
{ -1472, 520, 200}, { -1344, 552, 200}, { -1120, 464, 208}, // 23 seconds { -1272, 376, 288}, { -1600, 264, 448}, { -1560, 152, 488}, { -1392, 16, 440}, { -1320, 88, 448}, { -1224, 120, 296}, { -1104, 120, 312}, { -992, 104, 304}, { -1056, 200, 320}, { -1112, 72, 1...
{ -1096, 240, 96}, { -1296, 616, 304}, { -952, 768, 384}, { -1120, 856, 288}, { -984, 584, 232}, { -1040, 544, 184}, { -1280, 424, 160}, { -1600, 400, 280}, { -1600, 320, 264}, { -1384, 232, 240}, { -1344, 240, 264}, { -1368, 376, 392}, { -1288, 256, 312}, { -1112...
bitmap cl_assert_equal_i(s_bitblt_bitmap_into_bitmap_tiled_calls.call_count, 2); } #define EXPECTED_COMPOSITING_MODE_BEFORE_AND_AFTER_PRE_FUNCTION (GCompOpSet) #define EXPECTED_TINT_COLOR_BEFORE_AND_AFTER_PRE_FUNCTION (GColorShockingPink) #define COMPOSITING_MODE_TO_SPECIFY_IN_PRE_FUNCTION (GCompOpTint) #define TI...
cl_assert_equal_i(s_bitblt_bitmap_into_bitmap_tiled_calls.call_count, 1)
governing permissions and * limitations under the License. */ #include "dialog_spi.h" #include "board/board.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/spi.h" #include "drivers/spi_dma.h" #include "kernel/util/delay.h" #include "kernel/util/stop.h" #in...
(DIALOG_SPI)
e, size + 1)); cl_assert(!gdraw_command_sequence_validate(sequence, 0)); sequence->num_frames = 0; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 1; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 3; cl_assert(!gdraw_command_sequenc...
(command->points[0].x, 7)
; cl_assert_equal_p(gdraw_command_sequence_get_frame_by_index(sequence, 2), NULL); free(sequence); } void test_gdraw_command_sequence__clone(void) { cl_assert_equal_p(gdraw_command_sequence_clone(NULL), NULL); GDrawCommandSequence *sequence; prv_create_test_sequence(&sequence); GDrawCommandSequence *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...
gpio_release(GPIOB)
; } static uint32_t s_num_flash_uses = 0; void flash_impl_use(void) { if (s_num_flash_uses == 0) { periph_config_enable(FMC_Bank1, RCC_AHB3Periph_FMC); // FIXME prv_flash_idle_gpios(true); } s_num_flash_uses++; } void flash_impl_release_many(uint32_t num_locks) { PBL_ASSERTN(s_num_flash_uses >= num_l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(app_message_send_job)
; } else { read_pointer = (const uint8_t *)&app_message_send_job->header; num_bytes_available = (sizeof(PebbleProtocolHeader) - offset); } read_pointer += offset; *data_out = read_pointer; return num_bytes_available; } static size_t prv_send_job_impl_get_length(const SessionSendQueueJob *send_job) {...
#include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "services/common/system_task.h" #include "system/passert.h" #include <util/attributes.h> #include <util/net.h> #include "FreeRTOS.h" #include "semphr.h" #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> //! Modulus fo...
pulse_control_message_protocol_send_port_closed_message( &s_reliable_pcmp, bad_port)
; } void pulse2_reliable_transport_on_command_packet( void *raw_packet, size_t length) { if (!s_layer_up) { return; } if (length < sizeof((ReliablePacket){0}.s)) { PBL_LOG(LOG_LEVEL_DEBUG, "Received malformed command packet"); prv_bounce_ncp_state(); return; } ReliablePacket *packet = ra...
nt16_t)(y1 + num_pixels_per_mask_value - 1); record_func(ctx, x, y1, y2, src_color); } } cl_assert(graphics_context_mask_record(ctx, NULL)); test_graphics_context_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // APPLYING HORIZONTAL LINE...
{ for (int16_t row_index = 0; row_index < num_dest_colors; row_index++) { const int16_t starting_y = row_index * vline_applying_test_row_height; for (int16_t y = starting_y; y < starting_y + vline_applying_test_row_height; y++) { ctx->draw_state.stroke_color = (GColor) { .argb = (uint8_t)(row_in...
} static GDrawMask *prv_create_mask_for_vline_applying_test(GContext *ctx) { // The initial transparency doesn't really matter since we're about to overwrite it const bool transparent = false; GDrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx->de...
_imp->close) { // iAP sessions cannot be closed from the watch' side :( PBL_LOG(LOG_LEVEL_ERROR, "System session already exists and cannot be closed"); return NULL; } // Last system session to connect wins: // This is to work-around a race condition that happens whe...
session->transport_imp->is_current_task_schedule_task(session->transport)
; } return bt_driver_comm_is_current_task_send_next_task(); } void prv_send_next(CommSession *session, bool is_callback) { bt_lock(); { if (!comm_session_is_valid(session)) { // Session closed in the mean time goto unlock; } // Flip the flag before the send_next callback, so it can sche...
n't work with the comparisons we perform below if (slice->expiration_time == APP_GLANCE_SLICE_NO_EXPIRATION) { // We'll only use a never-expiring slice if we haven't set a slice yet if (!data->current_slice) { data->current_slice = slice; } // Continue iterating through the slices return tru...
kernel_free(app_glance)
is actually resolvable, but we need to lie to the SDK here to avoid // automatically cycling, see irb_ble_handler_gap_address_set_cmd(): desired_address_out->addr_type = PRIVATE_STATIC_ADDRESS; memcpy(&desired_address_out->addr, &s_local_addr_desired_policy.pinned_address.octets, sizeof(desired_address_...
{ prv_assert_is_executing_on_ble_task(); if (s_local_addr_state == LocalAddressState_AwaitingDisconnection) { PBL_LOG(LOG_LEVEL_DEBUG, "Got disconnection, trying to update own address"); prv_try_updating_own_address(); } }
void local_addr_init(void) { s_local_addr_state = LocalAddressState_Uninitialized; // Put all zeroes into ble_dev_params.own_address, as a known starting state. // The all zeroes address is used in prv_get_desired_own_address(), to check whether a resolvable // address has been generated yet or not. const ...
true; } void graphics_draw_pixel(){} void graphics_fill_rect(GContext* ctx, const GRect *rect) {} void graphics_private_draw_horizontal_line(){} void graphics_private_draw_vertical_line(){} void graphics_private_plot_pixel(){} void graphics_private_set_pixel(){} ///////////////////////////// static GPointPrecise s_...
GRect(2, 2, 5, 5)
!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); // reset line line = (Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_ad...
cl_assert(line.origin.x == 0)
; cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == '\n'); // \n cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'a'); cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 0); line_reset(&line, utf8_bounds.start); cl_assert(line_ad...
ize from = GSize(10, 20); GSize to = GSize(20, 40); GPoint point = GPoint(10, 10); GPoint result = GPointZero; result = gpoint_scale_by_gsize(point, from, to); cl_assert_equal_i(result.x, 20); cl_assert_equal_i(result.y, 20); } void test_gtypes__gpoint_scale_by_gsize_from_zero(void) { GSize from = GSize...
{ #if defined(PLATFORM_TINTIN) cl_assert_equal_i(2, PBL_IF_ROUND_ELSE(1,2)); #elif defined(PLATFORM_SNOWY) cl_assert_equal_i(2, PBL_IF_ROUND_ELSE(1,2)); #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(1, PBL_IF_ROUND_ELSE(1,2)); #else #error "unknown platform" #endif }
void test_gtypes__pbl_if_bw_else(void) { #if defined(PLATFORM_TINTIN) cl_assert_equal_i(1, PBL_IF_BW_ELSE(1,2)); #elif defined(PLATFORM_SNOWY) cl_assert_equal_i(2, PBL_IF_BW_ELSE(1,2)); #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(2, PBL_IF_BW_ELSE(1,2)); #else #error "unknown platform" #endif } void tes...
t bool is_mute_weekdays = mute_option == MuteBitfield_Weekdays; const bool is_mute_weekends = mute_option == MuteBitfield_Weekends; if (is_mute_weekdays || is_mute_weekends) { action_menu_level_add_action(root_level, mute_label_buf, pr...
window_long_click_subscribe(BUTTON_ID_SELECT, 1000, prv_select_long_click_handler, NULL)
; window_set_click_context(BUTTON_ID_SELECT, data); window_single_click_subscribe(BUTTON_ID_BACK, prv_back_button_single_click_handler); window_set_click_context(BUTTON_ID_BACK, data); if (s_notification_window_data.is_modal) { Window *window = &s_notification_window_data.window; window_set_overrides_...
ve_pair_text = GRect(0, -34, pair_text_area.size.w, 30); data->pair_text_area = pair_text_area; data->above_pair_text_area = above_pair_text; TextLayer *info_text_layer2 = &data->info_text_layer2; text_layer_init_with_parameters(info_text_layer2, &above_pair_text, ...
PBL_IF_RECT_ELSE(44, 46)
quest->list_node); if (conn_mgr_info->curr_requested_state == curr_request->req_state) { if (curr_ticks >= curr_request->timeout) { list_remove(&curr_request->list_node, (ListNode **)&conn_mgr_info->requests, NULL); kernel_free(curr_request); } } curr_request = next; } // No...
{ ConnectionMgrInfo *newinfo = kernel_malloc_check(sizeof(ConnectionMgrInfo)); *newinfo = (ConnectionMgrInfo) { .curr_requested_state = ResponseTimeMax, }; return newinfo; }
//! expects that the bt_lock is held void bt_conn_mgr_info_deinit(ConnectionMgrInfo **info) { // If we have any callbacks scheduled for this device, take them out RegularTimerInfo *watchdog_cb_info = &(*info)->watchdog_cb_info; if (regular_timer_is_scheduled(watchdog_cb_info)) { regular_timer_remove_callbac...
0x66, 0, 143, 0}, // 495: Local time: 2016-03-02 04:20:00 AM { 0, 0x65, 574, 147, 0}, { 16, 0x47, 2209, 146, 0}, { 0, 0x55, 402, 146, 0}, { 0, 0x55, 28, 146, 0}, { 16, 0x53, 5328, 160, 0}, { 13, 0x53, 5607, 146, 0}, { 15, 0x54, 1394, 146, 0}, { 0, 0x34, 0, 146, 0}, { 0, 0x34, 0, ...
{ 42, 0x52, 6890, 164, 0}, { 27, 0x43, 7135, 181, 0}, { 20, 0x64, 3922, 186, 0}, { 0, 0x7c, 0, 187, 1}, { 0, 0x7c, 0, 187, 1}, { 0, 0x7c, 0, 187, 1}, { 0, 0x7c, 0, 172, 1}, // 600: Local time: 2016-03-02 06:05:00 AM { 0, 0x7c, 0, 187, 1}, { 0, 0x7c, 0, 187, 1}, { 0, 0x7c, 0, ...
return samples; } // DESCRIPTION: // This test stops 9 minutes into a run. // - Test that when we shut activity down at 9 minutes into a run that nothing is saved. // ---------------------------------------------------------------- // Sample captured at: 2016-03-01 20:05:00 local, 2016-03-02 04:05:00 GMT AlgDls...
serial data for <%s>", buffer); prv_free_serialzed_prefs(serialized_prefs); return NULL; } const size_t alloc_size = attributes_actions_get_required_buffer_size(serialized_prefs->num_attributes, serialized_prefs->num_actions, ...
if (rv != S_SUCCESS) { return 0; }
OLOR, typical_end); } #else health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_start); health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_end); #endif } } static void prv_render_progress_bar(GContext *ctx, Layer *base_layer) { HealthSleepS...
(health_data)
> 0; } static void prv_base_layer_update_proc(Layer *base_layer, GContext *ctx) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); prv_render_icon(ctx, base_layer); prv_render_progress_bar(ctx, base_layer); if (!prv_has_sleep_data(data->health_data)) { prv_render_no_sleep_data_text(ctx, b...
ual_i(recognizers[1]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); // A second touchdown event occurs while recognizers are active. A different layer is touched, so // the active recognizers ...
recognizer_manager_handle_touch_event(&e, &manager)
; prv_compare_recognizers_processed((int[]) { 0 }, 1, &s_recognizers_handled); prv_compare_recognizers_processed((int[]) { 4, 0, 1 }, 3, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_i(recognizers[0...
(skip_errors, UINT16_MAX)
, .other_errors = MIN(other_errors, UINT16_MAX), }, }; ANALYTICS_LOG_DEBUG("GetBytesStats event: type: 0x%x, num_bytes: %"PRIu32", elapsed_ms: %"PRIu32, type, bytes_transferred, elapsed_time_ms); analytics_logging_log_event(&event_blob); }
}, { 1880, -96, 312}, { 1584, 264, 80}, { 1296, 528, -168}, { 992, 320, 16}, { 760, 224, 160}, { 840, 272, 64}, { 816, 264, 136}, { 800, 336, 88}, { 744, 328, 64}, { 704, 328, -8}, { 880, 352, -24}, { 1096, 328, 8}, { 1176, 304, -8}, { 1656, 208, 128}, { 1664,...
{ 1104, 360, -64}, { 1312, 320, -64}, { 1216, 304, -32}, { 1792, 376, 72}, { 1296, 408, 24}, { 856, 296, -48}, { 1072, 248, 88}, { 1048, 128, 208}, { 928, 120, 184}, { 928, 160, 152}, { 808, 40, 128}, { 752, -32, 112}, { 720, -8, 48}, { 736, -8, 56}, { 840, -6...
{ 1904, -168, 280}, { 1512, 328, -112}, { 1168, 552, -360}, { 1008, 280, 48}, { 800, 168, 88}, { 784, 248, 88}, { 856, 296, 192}, { 816, 384, 72}, { 736, 272, 56}, { 776, 416, -96}, { 904, 496, -200}, { 1288, 376, -128}, { 1312, 280, 24}, { 1880, 280, 80}, { ...
r_oom = false; s_sys_psleep_last_millis = 0; s_app_inbox_consume_call_count = 0; app_message_init(); app_message_set_context(&s_context); cl_assert_equal_i(app_message_open(MAX_SIZE_INBOUND, MAX_SIZE_OUTBOUND), APP_MSG_OK); cl_assert_equal_p(app_message_register_outbox_sent(prv_out_sent_callback), NULL); ...
(s_ack_sent_is_called, true)
; // Check that we were called cl_assert_equal_i(s_out_sent_call_count, 1); // Timer should be invalid cl_assert_equal_b(!fake_app_timer_is_scheduled(app_message_ack_timer_id()), true); // Check the state is reset properly cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_mes...
ms; } } bt_unlock(); if (is_ppogatt) { *is_ppogatt = tmp_is_ppogatt; } if (conn_interval) { *conn_interval = tmp_conn_interval; } return true; } void analytics_event_put_byte_stats( CommSession *session, bool crc_good, uint8_t type, uint32_t bytes_transferred, uint32_t elapsed_time_...
{ 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 (accessory_manager_set_state(AccessoryInputStateSmartstrap)) { // enable the accessory port accessory_set_baudrate(AccessoryBaud9600); accessory_set_power(true); smartstrap_comms_set_enabled(true); return true; } else { PBL_LOG(LOG_LEVEL_ERROR, "The accessory is already in use"); re...
t 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 CONDITIONS OF ANY KIND...
{ const PebbleBlobDBEvent *blob_db_event = &event->blob_db; const BlobDBId blob_db_id = blob_db_event->db_id; if (blob_db_id != BlobDBIdAppGlance) { // We only care about app glance changes return; } prv_glance_event_put((Uuid *)blob_db_event->key); }
static void prv_handle_app_cache_event(PebbleEvent *e, void *context) { if (e->app_cache_event.cache_event_type == PebbleAppCacheEvent_Removed) { Uuid app_uuid; app_install_get_uuid_for_install_id(e->app_cache_event.install_id, &app_uuid); app_glance_db_delete_glance(&app_uuid); } } /////////////////...
_states[NumBtConsumer]; void conn_mgr_set_ble_conn_response_time(GAPLEConnection *hdl, BtConsumer consumer, ResponseTimeState state, uint16_t max_period_secs) { s_conn_mgr_states[consumer].state = state; s_conn_mgr_states[consumer].max_period_secs = max_period_secs; } GAPL...
prv_discover_ams(1 /* num_instances */)
; cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); } void test_ams__dont_connect_music_service_if_subscribe_entity_update_characteristic_fails(void) { prv_discover_ams(1 /* num_instances */); // Simulate failed subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteri...
p_stats.mean, VARIANT_RANDOM); prv_save_state(ActivitySettingsKeyInsightSleepSummaryState, &s_sleep_pin_state, sizeof(s_sleep_pin_state)); } // ----------------------------------------------------------------------------------------- static void prv_do_sleep_su...
(&s_activity_reward_settings, &s_activity_reward_state.common, &s_activity_stats, now_utc)
) { return; } // Make sure the user is currently active if (s_activity_reward_state.active_minutes < s_activity_reward_settings.reward.activity.trigger_active_minutes) { INSIGHTS_LOG_DEBUG("Not showing activity reward - have only been currently active for " "%"PRIu16" minutes...
/* * 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...
(bus->hal->ev_irq_channel)
(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(0, 96)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(48, 96)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_comman...
weather_app_resource_create_sun()
; gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false); gdraw_command_image_draw(&ctx, l, GPoint(0, 144)); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false); gdraw_command_image_draw(&ctx...
us_idx].rail_ctl_fn(false); // Drain through pull-ups bus_pin_cfg_output(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl, false); bus_pin_cfg_output(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda, false); } //! Power up I2C bus power supply //! Always lock bus and peripheral config access before use static void bu...
ARRAY_LENGTH(i2c_buses)
; i++) { if (BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn) { BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn(); } if (BOARD_CONFIG.i2c_bus_configs[i].rail_ctl_fn) { bus_rail_power_down(i); } } } void i2c_use(I2cDevice device_id) { PBL_ASSERTN(s_initialized); PBL_ASSERT(device_id < BOARD_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...
(title, sizeof(title), "%d Bottles", num_beers)
; menu_cell_basic_draw(ctx, cell_layer, title, "of beer on the wall", (GBitmap*)&s_music_launcher_icon_bitmap); break; } case 1: menu_cell_title_draw(ctx, cell_layer, "Order More"); break; case 2: menu_cell_title_draw(ctx, cell_layer, "Drink!"); break; } } static void ...
/* * 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...
{ bus->spi->CR2 |= (uint16_t)dma_bits; }
bool prv_is_alive(void) { uint8_t chip_id; if (!prv_read_register(PmicRegisters_CHIP_ID, &chip_id)) { return false; } const bool found = (chip_id == AS3701B_CHIP_ID); if (found) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b"); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x...
{ // ChargerControl (Fig. 91) // Bit 5: Enable battery charging from USB charger. return prv_set_register_bit(PmicRegisters_CHARGE_CNTL, 5, enable); }
bool pmic_is_charging(void) { uint8_t status; if (!prv_read_register(PmicRegisters_CHARGE_STATUS_1, &status)) { #if defined (TARGET_QEMU) // NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed // i2c read means we are charging return true; #else PBL_LOG(LOG_LEVEL_DEBU...
/* * 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...
ALIAS("__aeabi_memcpy")
void __aeabi_memcpy4(void *dest, const void *src, size_t n); ALIAS("__aeabi_memcpy") void __aeabi_memcpy8(void *dest, const void *src, size_t n); void __aeabi_memset(void *s, size_t n, int c) { memset(s, c, n); } void __aeabi_memclr(void *addr, size_t n) { memset(addr, 0, n); } ALIAS("__aeabi_memclr") void __ae...
00, -264}, { 960, 360, -240}, { 864, 344, -280}, { 928, 312, -320}, { 928, 752, -424}, { 1136, 512, -568}, { 1384, 592, -480}, { 1008, 536, -456}, { 1280, 720, -640}, { 1056, 312, -704}, { 1256, 264, -600}, { 1336, 208, -416}, { 1392, 232, -264}, { 1184, 72, -168}, ...
{ 1328, 488, -520}, { 1336, 472, -512}, { 1376, 304, -368}, { 1320, 216, -232}, { 1032, 152, -224}, { 1056, 240, -200}, { 1232, 144, -192}, { 1240, 152, -136}, // 13 seconds { 1104, 32, -176}, { 1136, -40, -208}, { 872, -128, -168}, { 928, -136, -80}, { 1104, 16, ...
{ 1352, 144, -336}, { 1488, 136, -336}, { 1264, 232, -272}, { 968, 192, -240}, { 912, 248, -248}, { 1136, 280, -280}, { 1208, 352, -552}, { 1232, 448, -456}, { 1616, 872, -640}, { 1160, 672, -424}, { 1216, 600, -440}, { 1128, 576, -400}, { 1128, 416, -424}, { 128...
"applib/applib_malloc.auto.h" #include "applib/fonts/fonts.h" #include "applib/ui/bitmap_layer.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/dialog_private.h" #include "applib/ui/kino/kino_reel/scale_segmented.h" #include "applib/ui/layer.h" #include "applib/ui/text_layer.h" #include "applib/ui/...
{ text_top_margin_px += status_layer_offset; icon_top_margin_px += status_layer_offset; }
} y = text_top_margin_px; h = bounds->size.h - y; // Set up the text. TextLayer *text_layer = &dialog->text_layer; text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), dialog->buffer, dialog_text_font, dialog->text_color, GCol...
"Fatal error: a cleanup method raised an exception."); clar_report_errors(); exit(-1); } longjmp(_clar.trampoline, -1); } } void clar__assert_equal_s( const char *s1, const char *s2, const char *file, int line, const char *err, int should_abort) { int match = (s1 == NULL || ...
{ if (m1 == m2 || n == 0) { return; } if (m1 == NULL || m2 == NULL) { char buf[4096]; snprint_eq(buf, 4096, "'%p' != '%p'", m1, m2); clar__assert(0, file, line, err, buf, should_abort); } for (int offset = 0; offset < n; offset++) { if (m1[offset] == m2[offset]) { continue; } ...
void cl_set_cleanup(void (*cleanup)(void *), void *opaque) { _clar.local_cleanup = cleanup; _clar.local_cleanup_payload = opaque; } ${clar_modules} int _MAIN_CC main(int argc, char *argv[]) { return clar_test(argc, argv); }
/* * 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...
flash_read_bytes((uint8_t*) data_out, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, sizeof(*data_out))
; if (data_out->version != SHARED_PRF_STORAGE_VERSION) { // No data present, just return an empty struct with the current version set. prv_get_empty_struct(data_out); } } static void prv_perform_write(SharedPRFData *data, bool should_erase) { if (should_erase) { flash_erase_subsector_blocking(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...
((uint8_t*)&firmware_description, firmware_start_address, sizeof(FirmwareDescription))
; return firmware_description; } bool firmware_storage_check_valid_firmware_description(FirmwareDescription* desc) { return desc->description_length == sizeof(FirmwareDescription); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window, false)
; } static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section, void *callback_context) { return (uint16_t) ARRAY_LENGTH(s_tests); } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_c...
96, 376, -208}, { 1088, 296, -176}, { 952, 272, -176}, { 840, 232, -136}, { 784, 216, -144}, { 744, 160, -64}, { 728, 112, -104}, { 848, 136, -160}, { 896, 128, -200}, { 1232, 120, -176}, { 1112, 192, -208}, { 1128, 240, -432}, { 1304, 192, -360}, { 1104, 192, -184}, ...
{ 1536, 600, -296}, { 1256, 440, -272}, // 13 seconds { 1120, 528, -336}, { 888, 136, -40}, { 752, 160, -152}, { 648, 80, -112}, { 544, 40, -128}, { 576, -48, -152}, { 808, -32, -232}, { 928, -96, -216}, { 1080, -72, -184}, { 1224, 24, -256}, { 1232, 16, -288}, ...
{ 1320, 192, -168}, { 1144, 216, -328}, { 1304, 280, -336}, { 1280, 248, -224}, { 968, 208, -312}, { 832, 336, -304}, { 752, 384, -256}, { 752, 480, -248}, { 808, 552, -312}, { 848, 600, -304}, { 864, 608, -384}, // 16 seconds { 920, 624, -376}, { 944, 624, -336}...
/* * 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...
(file->iter.fd)
ect_get_max_x(&s_ctx.dest_bitmap.bounds), grect_get_max_y(&s_ctx.dest_bitmap.bounds)); GPoint offset_point = gpoint_sub(framebuffer_bottom_right_point, GPoint(bitmap->bounds.size.w, bitmap->bounds.size.h)); offset_point = gpoint_sub(offset_point, GPoint(COMPOSIT...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_y(void) { prv_offset_bitmap_layer_test(GPoint(0, 75)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_ny(void) { prv_offset_bitmap_layer_test(GPoint(0, -25)); cl_check(gbi...
//////////////////////////////////////////////////////// static void *prv_get_prefs(const char *pref_key) { status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return NULL; } const int len = settings_file_get_len(&s_watch_app_prefs_db.settings_file, pref_key, ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Error inserting app_prefs: invalid weather list"); return E_INVALID_ARGUMENT; }
status_t rv = prv_lock_mutex_and_open_file(); if (rv == S_SUCCESS) { rv = settings_file_set(&s_watch_app_prefs_db.settings_file, key, key_len, val, val_len); // Cache the data we just set if it was for the Reminders app const int expected_reminder_app_prefs_size = sizeof(SerializedReminderAppPrefs); ...
Watchface); } ResAppNum app_manager_get_current_resource_num(void) { return process_metadata_get_res_bank_num(s_app_task_context.app_md); } AppLaunchReason app_manager_get_launch_reason(void) { return s_next_app.common.reason; } ButtonId app_manager_get_launch_button(void) { return s_next_app.common.button; } ...
{ analytics_inc(ANALYTICS_DEVICE_METRIC_APP_QUICK_LAUNCH_COUNT, AnalyticsClient_System); analytics_inc(ANALYTICS_APP_METRIC_QUICK_LAUNCH_COUNT, AnalyticsClient_App); }
else if (launch_reason == APP_LAUNCH_USER) { analytics_inc(ANALYTICS_DEVICE_METRIC_APP_USER_LAUNCH_COUNT, AnalyticsClient_System); analytics_inc(ANALYTICS_APP_METRIC_USER_LAUNCH_COUNT, AnalyticsClient_App); } } // ------------------------------------------------------------------------------------------- /...
// The phone and watch time may be out of sync by a second or two (since // we don't account for the time it takes for the request to change the // time to propagate to the watch). Thus only update our alarm time if // the timezone has changed or a 'substantial' time has passed, or DST // stat...
if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)) { PBL_LOG(LOG_LEVEL_INFO, "Not launching worker because of 2 strikes"); } else { process_manager_launch_process(&(ProcessLaunchConfig) { .id = worker_manager_get_default_install_id(), .worker = true, }); }
h_card->layer.bounds; const GRect avg_text_box = {{ offset_x, offset_y }, { bounds->size.w, height }}; graphics_draw_text(ctx, graph_card->info_avg, graph_card->legend_font, avg_text_box, GTextOverflowModeWordWrap, GTextAlignmentLeft, NULL); } static void prv_draw_custom_info_text(HealthGraphC...
prv_draw_avg_info_text(graph_card, ctx, cursor_x, info_offset_y, info_height)
; cursor_x += avg_text_size.w; } else { // Center the custom text cursor_x = (bounds->size.w - total_width) / 2; } // Draw the custom info text prv_draw_custom_info_text(graph_card, ctx, text, cursor_x, info_offset_y, info_height); } static void prv_draw_info(HealthGraphCard *graph_card, GContext ...
_INT_STATUS_2_ANYM_FIRST_X, &direction); BMI160_DBG("Anymotion on axis %"PRIu8" in direction %"PRId32, axis, direction); accel_cb_shake_detected(axis, direction); } bool double_tap = ((int0_status & BMI160_INT_STATUS_0_D_TAP_MASK) != 0); if (double_tap) { int32_t direction; IMUCoordinateAxis axis ...
("Reading %d bytes", len)
nd_for_music_command(MusicCommand command) { switch (command) { case MusicCommandPlay: return 0x00; case MusicCommandPause: return 0x01; case MusicCommandTogglePlayPause: return 0x02; case MusicCommandNextTrack: return 0x03; case MusicCommandPreviousTrack: return 0x04...
(false /* reduced_latency */)
_animation_h, const uint32_t distance_normalized) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. property_animation_...
( distance_normalized, property_animation->values.from.gtransform.tx, property_animation->values.to.gtransform.tx)
t_bytes__cleanup(void) { put_bytes_deinit(); fake_comm_session_cleanup(); fake_system_task_callbacks_cleanup(); fake_event_clear_last(); fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); } ////////////////////////////////////////////////////////////////////////////////////////////////...
(VALID_OBJECT_SIZE, invalid_object_type)
{ 1016, 424, -176}, { 1112, 384, -96}, { 1216, 360, -32}, { 1272, 304, 0}, { 1104, 248, 16}, { 880, 240, -48}, { 784, 224, -128}, { 744, 176, -48}, { 776, 152, 0}, { 720, 136, 24}, { 752, 136, -40}, { 848, 152, -48}, { 1032, 216, -104}, // 24 seconds { 968, 216,...
{ 1136, 360, -168}, { 832, 320, -176}, { 656, 224, -184}, { 584, 192, -144}, { 608, 200, -96}, { 656, 208, -120}, { 736, 232, -152}, { 896, 288, -192}, { 1016, 328, -224}, { 1080, 360, -240}, { 1240, 408, -224}, { 1144, 416, -216}, { 1048, 400, -160}, { 1192, 368,...
ons]; bool r = attributes_actions_parse_serial_data(serialized_prefs->num_attributes, serialized_prefs->num_actions, serialized_prefs->data, serialized_prefs_data_len, ...
(&file, key, key_len, val, val_len)
; if (rv == S_SUCCESS) { char buffer[key_len + 1]; strncpy(buffer, (const char *)key, key_len); buffer[key_len] = '\0'; PBL_LOG(LOG_LEVEL_INFO, "iOS notif pref insert <%s>", buffer); // All records inserted from the phone are not dirty (the phone is the source of truth) rv = settings_file_mar...
/* * 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...
{ scaled_apbclock *= RCC_ClocksStatus.PCLK2_Frequency; }
else { scaled_apbclock *= RCC_ClocksStatus.PCLK1_Frequency; } if (dev->periph->CR1 & USART_CR1_OVER8) { scaled_apbclock <<= 1; } // calculate the baud rate value const uint32_t div = (scaled_apbclock / baud_rate); const uint32_t brr = (div & 0xFFF0) | ((div & 0xF) >> 1); // we can only change ...
6, 248}, { 992, 8, 200}, { 896, 8, 152}, { 768, 48, 128}, { 648, 32, 96}, { 664, -24, 88}, { 712, -64, 40}, { 912, 48, -128}, { 1320, -72, -112}, { 1776, -352, 376}, { 1624, 208, 280}, { 944, 840, -320}, { 944, 832, -64}, { 1184, 192, 384}, { 1032, 120, 336}, ...
// 83 seconds { 832, -56, 176}, { 888, 8, 40}, { 1016, 16, -48}, { 1136, 32, -112}, { 1512, -280, 224}, { 1400, -24, 160}, { 1080, 424, -176}, { 1176, 384, -192}, { 1128, 416, 8}, { 1000, 320, 152}, { 1024, 344, 224}, { 968, 440, 248}, { 824, 400, 176}, { 768,...
ating a file from the garbage collection region, // we don't need to search for free pages since we know what ones to use if (use_gc_allocator) { uint16_t next_page = (*free_page == INVALID_PAGE) ? s_gc_block.gc_start_page : (*free_page + 1); PBL_ASSERTN(s_gc_block.block_valid && (next_page >= s_gc_...
{ mutex_lock_recursive(s_pfs_mutex); find_free_page(&free_page, false, false); mutex_unlock_recursive(s_pfs_mutex); // TODO: might be nice to only sleep here if we had to perform GC as part // of finding a free page if ((pages_to_find % 4) == 0) { psleep(2); } pages_to_find--; ...
int usb_is_connected = battery_is_usb_connected(); switch (data->test_state) { case RuninStateStart: if (usb_is_connected) { next_state = RuninStateRunning; } else { next_state = RuninStatePlugCharger; } break; case RuninStatePlugCharger: if (usb_is_connected) { ...
text_layer_init(status, &window->layer.bounds)
NULL, }, .allocated_buffer = NULL, }, { .header = { // [1] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb2}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 10, ...
timeline_model_get_iter_state(0)
== timeline_model_get_iter_state_with_timeline_idx(0)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1)); int new_idx; bool has_next; cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 2); cl_assert_e...
2, -912}, { 32, 160, -936}, { 8, 152, -920}, { 24, 168, -920}, { 32, 136, -912}, { 24, 176, -920}, { 24, 144, -912}, // 242 seconds { 32, 160, -920}, { 24, 168, -928}, { 24, 160, -912}, { 32, 176, -928}, { 40, 184, -920}, { 8, 40, -904}, { 16, 144, -944}, { 32...
{ 16, 160, -912}, { 24, 128, -920}, { 24, 136, -920}, { 24, 168, -920}, { 24, 120, -920}, { 24, 136, -920}, { 16, 128, -920}, { 16, 152, -928}, { 32, 128, -912}, { 24, 168, -920}, // 248 seconds { 16, 136, -912}, { 24, 144, -920}, { 32, 168, -936}, { 8, 136, -...
{ 24, 192, -920}, { 24, 192, -912}, { 16, 176, -912}, { 24, 176, -912}, { 24, 184, -912}, { 24, 192, -920}, { 32, 152, -912}, { 32, 200, -912}, { 24, 160, -904}, { 0, 152, -912}, { 8, 184, -912}, { 24, 176, -904}, { 8, 176, -912}, { 16, 176, -904}, { 16, 208,...
ist_add_cstring(&list, AttributeIdRecordAway, "114-152"); attribute_list_add_cstring(&list, AttributeIdScoreAway, "86"); attribute_list_add_cstring(&list, AttributeIdNameHome, "CHI"); attribute_list_add_cstring(&list, AttributeIdRecordHome, "110-15"); attribute_list_add_cstring(&list, AttributeIdScoreHome, "103...
(&list, AttributeIdLastUpdated, now)
; TimelineItem *item = timeline_item_create_with_attributes(now + delta_time_s, 0, TimelineItemTypePin, LayoutIdGeneric, &list, NULL); pin_db_insert_item_without_event(item); timeline_item_dest...