src: Enable unused parameter warning
Fix warnings. Some clang-formatting was necessary. DebugPins is unused and was removed.
This commit is contained in:
parent
8b0d888952
commit
a3e14c012d
|
@ -24,10 +24,6 @@ if (NOT NRF5_SDK_PATH)
|
||||||
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
|
|
||||||
add_definitions(-DUSE_DEBUG_PINS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(BUILD_DFU)
|
if(BUILD_DFU)
|
||||||
set(BUILD_DFU true)
|
set(BUILD_DFU true)
|
||||||
endif()
|
endif()
|
||||||
|
@ -59,11 +55,6 @@ message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
||||||
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
|
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
|
||||||
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
||||||
message(" * Target device : " ${TARGET_DEVICE})
|
message(" * Target device : " ${TARGET_DEVICE})
|
||||||
if(USE_DEBUG_PINS)
|
|
||||||
message(" * Debug pins : Enabled")
|
|
||||||
else()
|
|
||||||
message(" * Debug pins : Disabled")
|
|
||||||
endif()
|
|
||||||
if(BUILD_DFU)
|
if(BUILD_DFU)
|
||||||
message(" * Build DFU (using adafruit-nrfutil) : Enabled")
|
message(" * Build DFU (using adafruit-nrfutil) : Enabled")
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -442,7 +442,6 @@ list(APPEND SOURCE_FILES
|
||||||
drivers/SpiMaster.cpp
|
drivers/SpiMaster.cpp
|
||||||
drivers/Spi.cpp
|
drivers/Spi.cpp
|
||||||
drivers/Watchdog.cpp
|
drivers/Watchdog.cpp
|
||||||
drivers/DebugPins.cpp
|
|
||||||
drivers/InternalFlash.cpp
|
drivers/InternalFlash.cpp
|
||||||
drivers/Hrs3300.cpp
|
drivers/Hrs3300.cpp
|
||||||
drivers/Bma421.cpp
|
drivers/Bma421.cpp
|
||||||
|
@ -509,7 +508,6 @@ list(APPEND RECOVERY_SOURCE_FILES
|
||||||
drivers/SpiMaster.cpp
|
drivers/SpiMaster.cpp
|
||||||
drivers/Spi.cpp
|
drivers/Spi.cpp
|
||||||
drivers/Watchdog.cpp
|
drivers/Watchdog.cpp
|
||||||
drivers/DebugPins.cpp
|
|
||||||
drivers/InternalFlash.cpp
|
drivers/InternalFlash.cpp
|
||||||
drivers/Hrs3300.cpp
|
drivers/Hrs3300.cpp
|
||||||
drivers/Bma421.cpp
|
drivers/Bma421.cpp
|
||||||
|
@ -625,7 +623,6 @@ set(INCLUDE_FILES
|
||||||
drivers/SpiMaster.h
|
drivers/SpiMaster.h
|
||||||
drivers/Spi.h
|
drivers/Spi.h
|
||||||
drivers/Watchdog.h
|
drivers/Watchdog.h
|
||||||
drivers/DebugPins.h
|
|
||||||
drivers/InternalFlash.h
|
drivers/InternalFlash.h
|
||||||
drivers/Hrs3300.h
|
drivers/Hrs3300.h
|
||||||
drivers/PinMap.h
|
drivers/PinMap.h
|
||||||
|
@ -689,6 +686,8 @@ include_directories(
|
||||||
${CMAKE_BINARY_DIR}/src # include generated files like Version.h
|
${CMAKE_BINARY_DIR}/src # include generated files like Version.h
|
||||||
.
|
.
|
||||||
../
|
../
|
||||||
|
)
|
||||||
|
include_directories(SYSTEM
|
||||||
libs/
|
libs/
|
||||||
FreeRTOS/
|
FreeRTOS/
|
||||||
libs/date/include
|
libs/date/include
|
||||||
|
@ -782,7 +781,7 @@ link_directories(
|
||||||
|
|
||||||
|
|
||||||
set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -ftree-vrp -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fstack-usage -fno-exceptions -fno-non-call-exceptions)
|
set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -ftree-vrp -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fstack-usage -fno-exceptions -fno-non-call-exceptions)
|
||||||
set(WARNING_FLAGS -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -Wreturn-type -Werror=return-type)
|
set(WARNING_FLAGS -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -Wreturn-type -Werror=return-type)
|
||||||
set(DEBUG_FLAGS -Og -g3)
|
set(DEBUG_FLAGS -Og -g3)
|
||||||
set(RELEASE_FLAGS -Os)
|
set(RELEASE_FLAGS -Os)
|
||||||
set(CXX_FLAGS -fno-rtti)
|
set(CXX_FLAGS -fno-rtti)
|
||||||
|
|
|
@ -35,9 +35,9 @@ namespace {
|
||||||
return client->OnDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc);
|
return client->OnDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int NewAlertSubcribeCallback(uint16_t conn_handle, const struct ble_gatt_error* error, struct ble_gatt_attr* attr, void* arg) {
|
int NewAlertSubcribeCallback(uint16_t conn_handle, const struct ble_gatt_error* error, struct ble_gatt_attr* /*attr*/, void* arg) {
|
||||||
auto client = static_cast<AlertNotificationClient*>(arg);
|
auto client = static_cast<AlertNotificationClient*>(arg);
|
||||||
return client->OnNewAlertSubcribe(conn_handle, error, attr);
|
return client->OnNewAlertSubcribe(conn_handle, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlertNotificationClient::OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error* error, ble_gatt_attr* attribute) {
|
int AlertNotificationClient::OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error* error) {
|
||||||
if (error->status == 0) {
|
if (error->status == 0) {
|
||||||
NRF_LOG_INFO("ANS New alert subscribe OK");
|
NRF_LOG_INFO("ANS New alert subscribe OK");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service);
|
bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service);
|
||||||
int OnCharacteristicsDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic);
|
int OnCharacteristicsDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic);
|
||||||
int OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error* error, ble_gatt_attr* attribute);
|
int OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error* error);
|
||||||
int OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle,
|
int OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle,
|
||||||
const ble_gatt_error* error,
|
const ble_gatt_error* error,
|
||||||
uint16_t characteristicValueHandle,
|
uint16_t characteristicValueHandle,
|
||||||
|
|
|
@ -11,9 +11,9 @@ constexpr ble_uuid16_t AlertNotificationService::ansUuid;
|
||||||
constexpr ble_uuid16_t AlertNotificationService::ansCharUuid;
|
constexpr ble_uuid16_t AlertNotificationService::ansCharUuid;
|
||||||
constexpr ble_uuid128_t AlertNotificationService::notificationEventUuid;
|
constexpr ble_uuid128_t AlertNotificationService::notificationEventUuid;
|
||||||
|
|
||||||
int AlertNotificationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int AlertNotificationCallback(uint16_t /*conn_handle*/, uint16_t /*attr_handle*/, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto anService = static_cast<AlertNotificationService*>(arg);
|
auto anService = static_cast<AlertNotificationService*>(arg);
|
||||||
return anService->OnAlert(conn_handle, attr_handle, ctxt);
|
return anService->OnAlert(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlertNotificationService::Init() {
|
void AlertNotificationService::Init() {
|
||||||
|
@ -44,7 +44,7 @@ AlertNotificationService::AlertNotificationService(System::SystemTask& systemTas
|
||||||
notificationManager {notificationManager} {
|
notificationManager {notificationManager} {
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int AlertNotificationService::OnAlert(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
||||||
constexpr size_t stringTerminatorSize = 1; // end of string '\0'
|
constexpr size_t stringTerminatorSize = 1; // end of string '\0'
|
||||||
constexpr size_t headerSize = 3;
|
constexpr size_t headerSize = 3;
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Pinetime {
|
||||||
AlertNotificationService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager);
|
AlertNotificationService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager);
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnAlert(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnAlert(struct ble_gatt_access_ctxt* ctxt);
|
||||||
|
|
||||||
void AcceptIncomingCall();
|
void AcceptIncomingCall();
|
||||||
void RejectIncomingCall();
|
void RejectIncomingCall();
|
||||||
|
|
|
@ -7,9 +7,9 @@ using namespace Pinetime::Controllers;
|
||||||
constexpr ble_uuid16_t BatteryInformationService::batteryInformationServiceUuid;
|
constexpr ble_uuid16_t BatteryInformationService::batteryInformationServiceUuid;
|
||||||
constexpr ble_uuid16_t BatteryInformationService::batteryLevelUuid;
|
constexpr ble_uuid16_t BatteryInformationService::batteryLevelUuid;
|
||||||
|
|
||||||
int BatteryInformationServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int BatteryInformationServiceCallback(uint16_t /*conn_handle*/, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto* batteryInformationService = static_cast<BatteryInformationService*>(arg);
|
auto* batteryInformationService = static_cast<BatteryInformationService*>(arg);
|
||||||
return batteryInformationService->OnBatteryServiceRequested(conn_handle, attr_handle, ctxt);
|
return batteryInformationService->OnBatteryServiceRequested(attr_handle, ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
BatteryInformationService::BatteryInformationService(Controllers::Battery& batteryController)
|
BatteryInformationService::BatteryInformationService(Controllers::Battery& batteryController)
|
||||||
|
@ -38,9 +38,7 @@ void BatteryInformationService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BatteryInformationService::OnBatteryServiceRequested(uint16_t connectionHandle,
|
int BatteryInformationService::OnBatteryServiceRequested(uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
||||||
uint16_t attributeHandle,
|
|
||||||
ble_gatt_access_ctxt* context) {
|
|
||||||
if (attributeHandle == batteryLevelHandle) {
|
if (attributeHandle == batteryLevelHandle) {
|
||||||
NRF_LOG_INFO("BATTERY : handle = %d", batteryLevelHandle);
|
NRF_LOG_INFO("BATTERY : handle = %d", batteryLevelHandle);
|
||||||
uint8_t batteryValue = batteryController.PercentRemaining();
|
uint8_t batteryValue = batteryController.PercentRemaining();
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Pinetime {
|
||||||
BatteryInformationService(Controllers::Battery& batteryController);
|
BatteryInformationService(Controllers::Battery& batteryController);
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
int OnBatteryServiceRequested(uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
||||||
void NotifyBatteryLevel(uint16_t connectionHandle, uint8_t level);
|
void NotifyBatteryLevel(uint16_t connectionHandle, uint8_t level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -89,7 +89,7 @@ int CurrentTimeClient::OnCurrentTimeReadResult(uint16_t conn_handle, const ble_g
|
||||||
|
|
||||||
NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", year, result.month, result.dayofmonth, result.hour, result.minute, result.second);
|
NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", year, result.month, result.dayofmonth, result.hour, result.minute, result.second);
|
||||||
dateTimeController
|
dateTimeController
|
||||||
.SetTime(year, result.month, result.dayofmonth, 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG));
|
.SetTime(year, result.month, result.dayofmonth, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG));
|
||||||
} else {
|
} else {
|
||||||
NRF_LOG_INFO("Error retrieving current time: %d", error->status);
|
NRF_LOG_INFO("Error retrieving current time: %d", error->status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,18 @@ constexpr ble_uuid16_t CurrentTimeService::ctsUuid;
|
||||||
constexpr ble_uuid16_t CurrentTimeService::ctsCtChrUuid;
|
constexpr ble_uuid16_t CurrentTimeService::ctsCtChrUuid;
|
||||||
constexpr ble_uuid16_t CurrentTimeService::ctsLtChrUuid;
|
constexpr ble_uuid16_t CurrentTimeService::ctsLtChrUuid;
|
||||||
|
|
||||||
int CTSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int CTSCallback(uint16_t /*conn_handle*/, uint16_t /*attr_handle*/, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto cts = static_cast<CurrentTimeService*>(arg);
|
auto cts = static_cast<CurrentTimeService*>(arg);
|
||||||
|
|
||||||
return cts->OnCurrentTimeServiceAccessed(conn_handle, attr_handle, ctxt);
|
return cts->OnCurrentTimeServiceAccessed(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CurrentTimeService::OnCurrentTimeServiceAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int CurrentTimeService::OnCurrentTimeServiceAccessed(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
switch (ble_uuid_u16(ctxt->chr->uuid)) {
|
switch (ble_uuid_u16(ctxt->chr->uuid)) {
|
||||||
case ctsCurrentTimeCharId:
|
case ctsCurrentTimeCharId:
|
||||||
return OnCurrentTimeAccessed(conn_handle, attr_handle, ctxt);
|
return OnCurrentTimeAccessed(ctxt);
|
||||||
case ctsLocalTimeCharId:
|
case ctsLocalTimeCharId:
|
||||||
return OnLocalTimeAccessed(conn_handle, attr_handle, ctxt);
|
return OnLocalTimeAccessed(ctxt);
|
||||||
}
|
}
|
||||||
return -1; // Unknown characteristic
|
return -1; // Unknown characteristic
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ void CurrentTimeService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CurrentTimeService::OnCurrentTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int CurrentTimeService::OnCurrentTimeAccessed(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
|
|
||||||
NRF_LOG_INFO("Setting time...");
|
NRF_LOG_INFO("Setting time...");
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ int CurrentTimeService::OnCurrentTimeAccessed(uint16_t conn_handle, uint16_t att
|
||||||
NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", year, result.month, result.dayofmonth, result.hour, result.minute, result.second);
|
NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", year, result.month, result.dayofmonth, result.hour, result.minute, result.second);
|
||||||
|
|
||||||
m_dateTimeController
|
m_dateTimeController
|
||||||
.SetTime(year, result.month, result.dayofmonth, 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG));
|
.SetTime(year, result.month, result.dayofmonth, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG));
|
||||||
|
|
||||||
} else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) {
|
} else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) {
|
||||||
CtsCurrentTimeData currentDateTime;
|
CtsCurrentTimeData currentDateTime;
|
||||||
|
@ -71,7 +71,7 @@ int CurrentTimeService::OnCurrentTimeAccessed(uint16_t conn_handle, uint16_t att
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CurrentTimeService::OnLocalTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int CurrentTimeService::OnLocalTimeAccessed(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
NRF_LOG_INFO("Setting timezone...");
|
NRF_LOG_INFO("Setting timezone...");
|
||||||
|
|
||||||
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
||||||
|
|
|
@ -16,9 +16,9 @@ namespace Pinetime {
|
||||||
CurrentTimeService(DateTime& dateTimeController);
|
CurrentTimeService(DateTime& dateTimeController);
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnCurrentTimeServiceAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnCurrentTimeServiceAccessed(struct ble_gatt_access_ctxt* ctxt);
|
||||||
int OnCurrentTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnCurrentTimeAccessed(struct ble_gatt_access_ctxt* ctxt);
|
||||||
int OnLocalTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnLocalTimeAccessed(struct ble_gatt_access_ctxt* ctxt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr uint16_t ctsId {0x1805};
|
static constexpr uint16_t ctsId {0x1805};
|
||||||
|
|
|
@ -10,9 +10,9 @@ constexpr ble_uuid16_t DeviceInformationService::deviceInfoUuid;
|
||||||
constexpr ble_uuid16_t DeviceInformationService::hwRevisionUuid;
|
constexpr ble_uuid16_t DeviceInformationService::hwRevisionUuid;
|
||||||
constexpr ble_uuid16_t DeviceInformationService::swRevisionUuid;
|
constexpr ble_uuid16_t DeviceInformationService::swRevisionUuid;
|
||||||
|
|
||||||
int DeviceInformationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int DeviceInformationCallback(uint16_t /*conn_handle*/, uint16_t /*attr_handle*/, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto deviceInformationService = static_cast<DeviceInformationService*>(arg);
|
auto deviceInformationService = static_cast<DeviceInformationService*>(arg);
|
||||||
return deviceInformationService->OnDeviceInfoRequested(conn_handle, attr_handle, ctxt);
|
return deviceInformationService->OnDeviceInfoRequested(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceInformationService::Init() {
|
void DeviceInformationService::Init() {
|
||||||
|
@ -24,7 +24,7 @@ void DeviceInformationService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeviceInformationService::OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int DeviceInformationService::OnDeviceInfoRequested(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
const char* str;
|
const char* str;
|
||||||
|
|
||||||
switch (ble_uuid_u16(ctxt->chr->uuid)) {
|
switch (ble_uuid_u16(ctxt->chr->uuid)) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Pinetime {
|
||||||
DeviceInformationService();
|
DeviceInformationService();
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnDeviceInfoRequested(struct ble_gatt_access_ctxt* ctxt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr uint16_t deviceInfoId {0x180a};
|
static constexpr uint16_t deviceInfoId {0x180a};
|
||||||
|
|
|
@ -9,9 +9,9 @@ constexpr ble_uuid16_t HeartRateService::heartRateServiceUuid;
|
||||||
constexpr ble_uuid16_t HeartRateService::heartRateMeasurementUuid;
|
constexpr ble_uuid16_t HeartRateService::heartRateMeasurementUuid;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int HeartRateServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int HeartRateServiceCallback(uint16_t /*conn_handle*/, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto* heartRateService = static_cast<HeartRateService*>(arg);
|
auto* heartRateService = static_cast<HeartRateService*>(arg);
|
||||||
return heartRateService->OnHeartRateRequested(conn_handle, attr_handle, ctxt);
|
return heartRateService->OnHeartRateRequested(attr_handle, ctxt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void HeartRateService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
int HeartRateService::OnHeartRateRequested(uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
||||||
if (attributeHandle == heartRateMeasurementHandle) {
|
if (attributeHandle == heartRateMeasurementHandle) {
|
||||||
NRF_LOG_INFO("HEARTRATE : handle = %d", heartRateMeasurementHandle);
|
NRF_LOG_INFO("HEARTRATE : handle = %d", heartRateMeasurementHandle);
|
||||||
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
||||||
|
@ -60,7 +60,7 @@ void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
||||||
if (!heartRateMeasurementNotificationEnable)
|
if (!heartRateMeasurementNotificationEnable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
uint8_t buffer[2] = {0, heartRateValue}; // [0] = flags, [1] = hr value
|
||||||
auto* om = ble_hs_mbuf_from_flat(buffer, 2);
|
auto* om = ble_hs_mbuf_from_flat(buffer, 2);
|
||||||
|
|
||||||
uint16_t connectionHandle = system.nimble().connHandle();
|
uint16_t connectionHandle = system.nimble().connHandle();
|
||||||
|
@ -72,12 +72,12 @@ void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
||||||
ble_gattc_notify_custom(connectionHandle, heartRateMeasurementHandle, om);
|
ble_gattc_notify_custom(connectionHandle, heartRateMeasurementHandle, om);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void HeartRateService::SubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == heartRateMeasurementHandle)
|
if (attributeHandle == heartRateMeasurementHandle)
|
||||||
heartRateMeasurementNotificationEnable = true;
|
heartRateMeasurementNotificationEnable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void HeartRateService::UnsubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == heartRateMeasurementHandle)
|
if (attributeHandle == heartRateMeasurementHandle)
|
||||||
heartRateMeasurementNotificationEnable = false;
|
heartRateMeasurementNotificationEnable = false;
|
||||||
}
|
}
|
|
@ -18,11 +18,11 @@ namespace Pinetime {
|
||||||
public:
|
public:
|
||||||
HeartRateService(Pinetime::System::SystemTask& system, Controllers::HeartRateController& heartRateController);
|
HeartRateService(Pinetime::System::SystemTask& system, Controllers::HeartRateController& heartRateController);
|
||||||
void Init();
|
void Init();
|
||||||
int OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
int OnHeartRateRequested(uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
||||||
void OnNewHeartRateValue(uint8_t hearRateValue);
|
void OnNewHeartRateValue(uint8_t hearRateValue);
|
||||||
|
|
||||||
void SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle);
|
void SubscribeNotification(uint16_t attributeHandle);
|
||||||
void UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle);
|
void UnsubscribeNotification(uint16_t attributeHandle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pinetime::System::SystemTask& system;
|
Pinetime::System::SystemTask& system;
|
||||||
|
|
|
@ -9,9 +9,9 @@ constexpr ble_uuid16_t ImmediateAlertService::immediateAlertServiceUuid;
|
||||||
constexpr ble_uuid16_t ImmediateAlertService::alertLevelUuid;
|
constexpr ble_uuid16_t ImmediateAlertService::alertLevelUuid;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int AlertLevelCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int AlertLevelCallback(uint16_t /*conn_handle*/, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto* immediateAlertService = static_cast<ImmediateAlertService*>(arg);
|
auto* immediateAlertService = static_cast<ImmediateAlertService*>(arg);
|
||||||
return immediateAlertService->OnAlertLevelChanged(conn_handle, attr_handle, ctxt);
|
return immediateAlertService->OnAlertLevelChanged(attr_handle, ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ToString(ImmediateAlertService::Levels level) {
|
const char* ToString(ImmediateAlertService::Levels level) {
|
||||||
|
@ -56,7 +56,7 @@ void ImmediateAlertService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImmediateAlertService::OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
int ImmediateAlertService::OnAlertLevelChanged(uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
||||||
if (attributeHandle == alertLevelHandle) {
|
if (attributeHandle == alertLevelHandle) {
|
||||||
if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
||||||
auto alertLevel = static_cast<Levels>(context->om->om_data[0]);
|
auto alertLevel = static_cast<Levels>(context->om->om_data[0]);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
ImmediateAlertService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager);
|
ImmediateAlertService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager);
|
||||||
void Init();
|
void Init();
|
||||||
int OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
int OnAlertLevelChanged(uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pinetime::System::SystemTask& systemTask;
|
Pinetime::System::SystemTask& systemTask;
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace {
|
||||||
constexpr ble_uuid128_t stepCountCharUuid {CharUuid(0x01, 0x00)};
|
constexpr ble_uuid128_t stepCountCharUuid {CharUuid(0x01, 0x00)};
|
||||||
constexpr ble_uuid128_t motionValuesCharUuid {CharUuid(0x02, 0x00)};
|
constexpr ble_uuid128_t motionValuesCharUuid {CharUuid(0x02, 0x00)};
|
||||||
|
|
||||||
int MotionServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int MotionServiceCallback(uint16_t /*conn_handle*/, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto* motionService = static_cast<MotionService*>(arg);
|
auto* motionService = static_cast<MotionService*>(arg);
|
||||||
return motionService->OnStepCountRequested(conn_handle, attr_handle, ctxt);
|
return motionService->OnStepCountRequested(attr_handle, ctxt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void MotionService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MotionService::OnStepCountRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
|
||||||
if (attributeHandle == stepCountHandle) {
|
if (attributeHandle == stepCountHandle) {
|
||||||
NRF_LOG_INFO("Motion-stepcount : handle = %d", stepCountHandle);
|
NRF_LOG_INFO("Motion-stepcount : handle = %d", stepCountHandle);
|
||||||
uint32_t buffer = motionController.NbSteps();
|
uint32_t buffer = motionController.NbSteps();
|
||||||
|
@ -95,7 +95,7 @@ void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
|
||||||
if (!motionValuesNoficationEnabled)
|
if (!motionValuesNoficationEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int16_t buffer[3] = {motionController.X(), motionController.Y(), motionController.Z()};
|
int16_t buffer[3] = {x, y, z};
|
||||||
auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t));
|
auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t));
|
||||||
|
|
||||||
uint16_t connectionHandle = system.nimble().connHandle();
|
uint16_t connectionHandle = system.nimble().connHandle();
|
||||||
|
@ -107,14 +107,14 @@ void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
|
||||||
ble_gattc_notify_custom(connectionHandle, motionValuesHandle, om);
|
ble_gattc_notify_custom(connectionHandle, motionValuesHandle, om);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void MotionService::SubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == stepCountHandle)
|
if (attributeHandle == stepCountHandle)
|
||||||
stepCountNoficationEnabled = true;
|
stepCountNoficationEnabled = true;
|
||||||
else if (attributeHandle == motionValuesHandle)
|
else if (attributeHandle == motionValuesHandle)
|
||||||
motionValuesNoficationEnabled = true;
|
motionValuesNoficationEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle) {
|
void MotionService::UnsubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == stepCountHandle)
|
if (attributeHandle == stepCountHandle)
|
||||||
stepCountNoficationEnabled = false;
|
stepCountNoficationEnabled = false;
|
||||||
else if (attributeHandle == motionValuesHandle)
|
else if (attributeHandle == motionValuesHandle)
|
||||||
|
|
|
@ -18,12 +18,12 @@ namespace Pinetime {
|
||||||
public:
|
public:
|
||||||
MotionService(Pinetime::System::SystemTask& system, Controllers::MotionController& motionController);
|
MotionService(Pinetime::System::SystemTask& system, Controllers::MotionController& motionController);
|
||||||
void Init();
|
void Init();
|
||||||
int OnStepCountRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
int OnStepCountRequested(uint16_t attributeHandle, ble_gatt_access_ctxt* context);
|
||||||
void OnNewStepCountValue(uint32_t stepCount);
|
void OnNewStepCountValue(uint32_t stepCount);
|
||||||
void OnNewMotionValues(int16_t x, int16_t y, int16_t z);
|
void OnNewMotionValues(int16_t x, int16_t y, int16_t z);
|
||||||
|
|
||||||
void SubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle);
|
void SubscribeNotification(uint16_t attributeHandle);
|
||||||
void UnsubscribeNotification(uint16_t connectionHandle, uint16_t attributeHandle);
|
void UnsubscribeNotification(uint16_t attributeHandle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pinetime::System::SystemTask& system;
|
Pinetime::System::SystemTask& system;
|
||||||
|
|
|
@ -48,8 +48,8 @@ namespace {
|
||||||
|
|
||||||
constexpr uint8_t MaxStringSize {40};
|
constexpr uint8_t MaxStringSize {40};
|
||||||
|
|
||||||
int MusicCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int MusicCallback(uint16_t /*conn_handle*/, uint16_t /*attr_handle*/, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
return static_cast<Pinetime::Controllers::MusicService*>(arg)->OnCommand(conn_handle, attr_handle, ctxt);
|
return static_cast<Pinetime::Controllers::MusicService*>(arg)->OnCommand(ctxt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ void Pinetime::Controllers::MusicService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int Pinetime::Controllers::MusicService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
||||||
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om);
|
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om);
|
||||||
size_t bufferSize = notifSize;
|
size_t bufferSize = notifSize;
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnCommand(struct ble_gatt_access_ctxt* ctxt);
|
||||||
|
|
||||||
void event(char event);
|
void event(char event);
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,9 @@ namespace {
|
||||||
constexpr ble_uuid128_t navManDistCharUuid {CharUuid(0x03, 0x00)};
|
constexpr ble_uuid128_t navManDistCharUuid {CharUuid(0x03, 0x00)};
|
||||||
constexpr ble_uuid128_t navProgressCharUuid {CharUuid(0x04, 0x00)};
|
constexpr ble_uuid128_t navProgressCharUuid {CharUuid(0x04, 0x00)};
|
||||||
|
|
||||||
int NAVCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int NAVCallback(uint16_t /*conn_handle*/, uint16_t /*attr_handle*/, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
auto* navService = static_cast<Pinetime::Controllers::NavigationService*>(arg);
|
auto* navService = static_cast<Pinetime::Controllers::NavigationService*>(arg);
|
||||||
return navService->OnCommand(conn_handle, attr_handle, ctxt);
|
return navService->OnCommand(ctxt);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ void Pinetime::Controllers::NavigationService::Init() {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Pinetime::Controllers::NavigationService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
|
int Pinetime::Controllers::NavigationService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
|
|
||||||
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
||||||
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om);
|
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
int OnCommand(struct ble_gatt_access_ctxt* ctxt);
|
||||||
|
|
||||||
std::string getFlag();
|
std::string getFlag();
|
||||||
|
|
||||||
|
|
|
@ -322,14 +322,14 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
|
||||||
event->subscribe.prev_indicate);
|
event->subscribe.prev_indicate);
|
||||||
|
|
||||||
if (event->subscribe.reason == BLE_GAP_SUBSCRIBE_REASON_TERM) {
|
if (event->subscribe.reason == BLE_GAP_SUBSCRIBE_REASON_TERM) {
|
||||||
heartRateService.UnsubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
heartRateService.UnsubscribeNotification(event->subscribe.attr_handle);
|
||||||
motionService.UnsubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
motionService.UnsubscribeNotification(event->subscribe.attr_handle);
|
||||||
} else if (event->subscribe.prev_notify == 0 && event->subscribe.cur_notify == 1) {
|
} else if (event->subscribe.prev_notify == 0 && event->subscribe.cur_notify == 1) {
|
||||||
heartRateService.SubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
heartRateService.SubscribeNotification(event->subscribe.attr_handle);
|
||||||
motionService.SubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
motionService.SubscribeNotification(event->subscribe.attr_handle);
|
||||||
} else if (event->subscribe.prev_notify == 1 && event->subscribe.cur_notify == 0) {
|
} else if (event->subscribe.prev_notify == 1 && event->subscribe.cur_notify == 0) {
|
||||||
heartRateService.UnsubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
heartRateService.UnsubscribeNotification(event->subscribe.attr_handle);
|
||||||
motionService.UnsubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
motionService.UnsubscribeNotification(event->subscribe.attr_handle);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
#include "libs/QCBOR/inc/qcbor/qcbor.h"
|
#include "libs/QCBOR/inc/qcbor/qcbor.h"
|
||||||
#include "systemtask/SystemTask.h"
|
#include "systemtask/SystemTask.h"
|
||||||
|
|
||||||
int WeatherCallback(uint16_t connHandle, uint16_t attrHandle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
int WeatherCallback(uint16_t /*connHandle*/, uint16_t /*attrHandle*/, struct ble_gatt_access_ctxt* ctxt, void* arg) {
|
||||||
return static_cast<Pinetime::Controllers::WeatherService*>(arg)->OnCommand(connHandle, attrHandle, ctxt);
|
return static_cast<Pinetime::Controllers::WeatherService*>(arg)->OnCommand(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
|
@ -41,7 +41,7 @@ namespace Pinetime {
|
||||||
ASSERT(res == 0);
|
ASSERT(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WeatherService::OnCommand(uint16_t connHandle, uint16_t attrHandle, struct ble_gatt_access_ctxt* ctxt) {
|
int WeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
|
||||||
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
|
||||||
const uint8_t packetLen = OS_MBUF_PKTLEN(ctxt->om); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
const uint8_t packetLen = OS_MBUF_PKTLEN(ctxt->om); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||||
if (packetLen <= 0) {
|
if (packetLen <= 0) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
int OnCommand(uint16_t connHandle, uint16_t attrHandle, struct ble_gatt_access_ctxt* ctxt);
|
int OnCommand(struct ble_gatt_access_ctxt* ctxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper functions for quick access to currently valid data
|
* Helper functions for quick access to currently valid data
|
||||||
|
|
|
@ -20,14 +20,7 @@ void DateTime::SetCurrentTime(std::chrono::time_point<std::chrono::system_clock,
|
||||||
UpdateTime(previousSystickCounter); // Update internal state without updating the time
|
UpdateTime(previousSystickCounter); // Update internal state without updating the time
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateTime::SetTime(uint16_t year,
|
void DateTime::SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter) {
|
||||||
uint8_t month,
|
|
||||||
uint8_t day,
|
|
||||||
uint8_t dayOfWeek,
|
|
||||||
uint8_t hour,
|
|
||||||
uint8_t minute,
|
|
||||||
uint8_t second,
|
|
||||||
uint32_t systickCounter) {
|
|
||||||
std::tm tm = {
|
std::tm tm = {
|
||||||
/* .tm_sec = */ second,
|
/* .tm_sec = */ second,
|
||||||
/* .tm_min = */ minute,
|
/* .tm_min = */ minute,
|
||||||
|
|
|
@ -31,14 +31,7 @@ namespace Pinetime {
|
||||||
December
|
December
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetTime(uint16_t year,
|
void SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter);
|
||||||
uint8_t month,
|
|
||||||
uint8_t day,
|
|
||||||
uint8_t dayOfWeek,
|
|
||||||
uint8_t hour,
|
|
||||||
uint8_t minute,
|
|
||||||
uint8_t second,
|
|
||||||
uint32_t systickCounter);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* setter corresponding to the BLE Set Local Time characteristic.
|
* setter corresponding to the BLE Set Local Time characteristic.
|
||||||
|
|
|
@ -115,7 +115,7 @@ lfs_ssize_t FS::GetFSSize() {
|
||||||
----------- Interface between littlefs and SpiNorFlash -----------
|
----------- Interface between littlefs and SpiNorFlash -----------
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int FS::SectorSync(const struct lfs_config* c) {
|
int FS::SectorSync(const struct lfs_config* /*c*/) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ int FS::SectorRead(const struct lfs_config* c, lfs_block_t block, lfs_off_t off,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
lv_fs_res_t lvglOpen(lv_fs_drv_t* drv, void* file_p, const char* path, lv_fs_mode_t mode) {
|
lv_fs_res_t lvglOpen(lv_fs_drv_t* drv, void* file_p, const char* path, lv_fs_mode_t /*mode*/) {
|
||||||
lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
|
lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
|
||||||
FS* filesys = static_cast<FS*>(drv->user_data);
|
FS* filesys = static_cast<FS*>(drv->user_data);
|
||||||
int res = filesys->FileOpen(file, path, LFS_O_RDONLY);
|
int res = filesys->FileOpen(file, path, LFS_O_RDONLY);
|
||||||
|
|
|
@ -34,6 +34,6 @@ void MotorController::StopRinging() {
|
||||||
nrf_gpio_pin_set(PinMap::Motor);
|
nrf_gpio_pin_set(PinMap::Motor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorController::StopMotor(TimerHandle_t xTimer) {
|
void MotorController::StopMotor(TimerHandle_t /*xTimer*/) {
|
||||||
nrf_gpio_pin_set(PinMap::Motor);
|
nrf_gpio_pin_set(PinMap::Motor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,22 +11,22 @@
|
||||||
using namespace Pinetime::Applications;
|
using namespace Pinetime::Applications;
|
||||||
|
|
||||||
DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
Components::LittleVgl& lvgl,
|
Components::LittleVgl& /*lvgl*/,
|
||||||
Drivers::Cst816S& touchPanel,
|
Drivers::Cst816S& /*touchPanel*/,
|
||||||
Controllers::Battery& batteryController,
|
Controllers::Battery& /*batteryController*/,
|
||||||
Controllers::Ble& bleController,
|
Controllers::Ble& bleController,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& /*dateTimeController*/,
|
||||||
Drivers::WatchdogView& watchdog,
|
Drivers::WatchdogView& /*watchdog*/,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& /*notificationManager*/,
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController,
|
Pinetime::Controllers::HeartRateController& /*heartRateController*/,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& /*settingsController*/,
|
||||||
Pinetime::Controllers::MotorController& motorController,
|
Pinetime::Controllers::MotorController& /*motorController*/,
|
||||||
Pinetime::Controllers::MotionController& motionController,
|
Pinetime::Controllers::MotionController& /*motionController*/,
|
||||||
Pinetime::Controllers::TimerController& timerController,
|
Pinetime::Controllers::TimerController& /*timerController*/,
|
||||||
Pinetime::Controllers::AlarmController& alarmController,
|
Pinetime::Controllers::AlarmController& /*alarmController*/,
|
||||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
Pinetime::Controllers::BrightnessController& /*brightnessController*/,
|
||||||
Pinetime::Controllers::TouchHandler& touchHandler,
|
Pinetime::Controllers::TouchHandler& /*touchHandler*/,
|
||||||
Pinetime::Controllers::FS& filesystem)
|
Pinetime::Controllers::FS& /*filesystem*/)
|
||||||
: lcd {lcd}, bleController {bleController} {
|
: lcd {lcd}, bleController {bleController} {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,5 +121,5 @@ void DisplayApp::PushMessage(Display::Messages msg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) {
|
void DisplayApp::Register(Pinetime::System::SystemTask* /*systemTask*/) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,11 +79,11 @@ void Paddle::Refresh() {
|
||||||
lv_label_set_text_fmt(points, "%04d", score);
|
lv_label_set_text_fmt(points, "%04d", score);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents /*event*/) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Paddle::OnTouchEvent(uint16_t x, uint16_t y) {
|
bool Paddle::OnTouchEvent(uint16_t /*x*/, uint16_t y) {
|
||||||
// sets the center paddle pos. (30px offset) with the the y_coordinate of the finger
|
// sets the center paddle pos. (30px offset) with the the y_coordinate of the finger
|
||||||
// but clamp it such that the paddle never clips off screen
|
// but clamp it such that the paddle never clips off screen
|
||||||
if (y < 31) {
|
if (y < 31) {
|
||||||
|
|
|
@ -67,11 +67,11 @@ namespace Pinetime {
|
||||||
|
|
||||||
/** @return false if the event hasn't been handled by the app, true if it has been handled */
|
/** @return false if the event hasn't been handled by the app, true if it has been handled */
|
||||||
// Returning true will cancel lvgl tap
|
// Returning true will cancel lvgl tap
|
||||||
virtual bool OnTouchEvent(TouchEvents event) {
|
virtual bool OnTouchEvent(TouchEvents /*event*/) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool OnTouchEvent(uint16_t x, uint16_t y) {
|
virtual bool OnTouchEvent(uint16_t /*x*/, uint16_t /*y*/) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ using namespace Pinetime::Applications::Screens;
|
||||||
namespace {
|
namespace {
|
||||||
void OnBluetoothDisabledEvent(lv_obj_t* obj, lv_event_t event) {
|
void OnBluetoothDisabledEvent(lv_obj_t* obj, lv_event_t event) {
|
||||||
auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
|
auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
|
||||||
screen->OnBluetoothDisabled(obj, event);
|
screen->OnBluetoothDisabled(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnBluetoothEnabledEvent(lv_obj_t* obj, lv_event_t event) {
|
void OnBluetoothEnabledEvent(lv_obj_t* obj, lv_event_t event) {
|
||||||
auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
|
auto* screen = static_cast<SettingBluetooth*>(obj->user_data);
|
||||||
screen->OnBluetoothEnabled(obj, event);
|
screen->OnBluetoothEnabled(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ SettingBluetooth::~SettingBluetooth() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingBluetooth::OnBluetoothDisabled(lv_obj_t* object, lv_event_t event) {
|
void SettingBluetooth::OnBluetoothDisabled(lv_event_t event) {
|
||||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||||
lv_checkbox_set_checked(cbEnabled, false);
|
lv_checkbox_set_checked(cbEnabled, false);
|
||||||
lv_checkbox_set_checked(cbDisabled, true);
|
lv_checkbox_set_checked(cbDisabled, true);
|
||||||
|
@ -83,7 +83,7 @@ void SettingBluetooth::OnBluetoothDisabled(lv_obj_t* object, lv_event_t event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingBluetooth::OnBluetoothEnabled(lv_obj_t* object, lv_event_t event) {
|
void SettingBluetooth::OnBluetoothEnabled(lv_event_t event) {
|
||||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||||
lv_checkbox_set_checked(cbEnabled, true);
|
lv_checkbox_set_checked(cbEnabled, true);
|
||||||
lv_checkbox_set_checked(cbDisabled, false);
|
lv_checkbox_set_checked(cbDisabled, false);
|
||||||
|
|
|
@ -17,8 +17,8 @@ namespace Pinetime {
|
||||||
SettingBluetooth(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
SettingBluetooth(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
|
||||||
~SettingBluetooth() override;
|
~SettingBluetooth() override;
|
||||||
|
|
||||||
void OnBluetoothEnabled(lv_obj_t* object, lv_event_t event);
|
void OnBluetoothEnabled(lv_event_t event);
|
||||||
void OnBluetoothDisabled(lv_obj_t* object, lv_event_t event);
|
void OnBluetoothDisabled(lv_event_t event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
|
|
|
@ -100,7 +100,6 @@ void SettingSetDate::HandleButtonPress() {
|
||||||
dateTimeController.SetTime(yearValue,
|
dateTimeController.SetTime(yearValue,
|
||||||
monthValue,
|
monthValue,
|
||||||
dayValue,
|
dayValue,
|
||||||
0,
|
|
||||||
dateTimeController.Hours(),
|
dateTimeController.Hours(),
|
||||||
dateTimeController.Minutes(),
|
dateTimeController.Minutes(),
|
||||||
dateTimeController.Seconds(),
|
dateTimeController.Seconds(),
|
||||||
|
|
|
@ -99,7 +99,6 @@ void SettingSetTime::SetTime() {
|
||||||
dateTimeController.SetTime(dateTimeController.Year(),
|
dateTimeController.SetTime(dateTimeController.Year(),
|
||||||
static_cast<uint8_t>(dateTimeController.Month()),
|
static_cast<uint8_t>(dateTimeController.Month()),
|
||||||
dateTimeController.Day(),
|
dateTimeController.Day(),
|
||||||
static_cast<uint8_t>(dateTimeController.DayOfWeek()),
|
|
||||||
static_cast<uint8_t>(hoursValue),
|
static_cast<uint8_t>(hoursValue),
|
||||||
static_cast<uint8_t>(minutesValue),
|
static_cast<uint8_t>(minutesValue),
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_delay(uint32_t period_us, void* intf_ptr) {
|
void user_delay(uint32_t period_us, void* /*intf_ptr*/) {
|
||||||
nrf_delay_us(period_us);
|
nrf_delay_us(period_us);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
DebugPin0 = 27,
|
|
||||||
DebugPin1 = 29,
|
|
||||||
DebugPin2 = 20,
|
|
||||||
DebugPin3 = 17,
|
|
||||||
DebugPin4 = 11,
|
|
||||||
} debugpins_pins;
|
|
||||||
|
|
||||||
void debugpins_init();
|
|
||||||
void debugpins_set(debugpins_pins pin);
|
|
||||||
void debugpins_clear(debugpins_pins pin);
|
|
||||||
void debugpins_pulse(debugpins_pins pin);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -163,10 +163,7 @@ void SpiMaster::PrepareTx(const volatile uint32_t bufferAddress, const volatile
|
||||||
spiBaseAddress->EVENTS_END = 0;
|
spiBaseAddress->EVENTS_END = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiMaster::PrepareRx(const volatile uint32_t cmdAddress,
|
void SpiMaster::PrepareRx(const volatile uint32_t bufferAddress, const volatile size_t size) {
|
||||||
const volatile size_t cmdSize,
|
|
||||||
const volatile uint32_t bufferAddress,
|
|
||||||
const volatile size_t size) {
|
|
||||||
spiBaseAddress->TXD.PTR = 0;
|
spiBaseAddress->TXD.PTR = 0;
|
||||||
spiBaseAddress->TXD.MAXCNT = 0;
|
spiBaseAddress->TXD.MAXCNT = 0;
|
||||||
spiBaseAddress->TXD.LIST = 0;
|
spiBaseAddress->TXD.LIST = 0;
|
||||||
|
@ -234,7 +231,7 @@ bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data
|
||||||
while (spiBaseAddress->EVENTS_END == 0)
|
while (spiBaseAddress->EVENTS_END == 0)
|
||||||
;
|
;
|
||||||
|
|
||||||
PrepareRx((uint32_t) cmd, cmdSize, (uint32_t) data, dataSize);
|
PrepareRx((uint32_t) data, dataSize);
|
||||||
spiBaseAddress->TASKS_START = 1;
|
spiBaseAddress->TASKS_START = 1;
|
||||||
|
|
||||||
while (spiBaseAddress->EVENTS_END == 0)
|
while (spiBaseAddress->EVENTS_END == 0)
|
||||||
|
|
|
@ -46,10 +46,7 @@ namespace Pinetime {
|
||||||
void SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
|
void SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
|
||||||
void DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
|
void DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
|
||||||
void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size);
|
void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size);
|
||||||
void PrepareRx(const volatile uint32_t cmdAddress,
|
void PrepareRx(const volatile uint32_t bufferAddress, const volatile size_t size);
|
||||||
const volatile size_t cmdSize,
|
|
||||||
const volatile uint32_t bufferAddress,
|
|
||||||
const volatile size_t size);
|
|
||||||
|
|
||||||
NRF_SPIM_Type* spiBaseAddress;
|
NRF_SPIM_Type* spiBaseAddress;
|
||||||
uint8_t pinCsn;
|
uint8_t pinCsn;
|
||||||
|
|
|
@ -82,7 +82,7 @@ void RefreshWatchdog() {
|
||||||
|
|
||||||
uint8_t displayBuffer[displayWidth * bytesPerPixel];
|
uint8_t displayBuffer[displayWidth * bytesPerPixel];
|
||||||
|
|
||||||
void Process(void* instance) {
|
void Process(void* /*instance*/) {
|
||||||
RefreshWatchdog();
|
RefreshWatchdog();
|
||||||
APP_GPIOTE_INIT(2);
|
APP_GPIOTE_INIT(2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user