Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:6f55e05bb7a0, committed 2018-05-13
- Comitter:
- LAINO
- Date:
- Sun May 13 09:43:00 2018 +0000
- Parent:
- 0:d18ffa2b40b3
- Commit message:
- king
Changed in this revision
| BME680.lib | Show annotated file Show diff for this revision Revisions of this file |
| source/main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BME680.lib Sun May 13 09:43:00 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/yangcq88517/code/BME680/#85088a918342
--- a/source/main.cpp Sat Apr 21 08:25:59 2018 +0000
+++ b/source/main.cpp Sun May 13 09:43:00 2018 +0000
@@ -1,55 +1,39 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2014 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
#include <events/mbed_events.h>
#include <mbed.h>
#include "ble/BLE.h"
#include "ble/Gap.h"
#include "ble/services/BatteryService.h"
-
-DigitalOut led1(LED1, 1);
+#include "LEDService.h"
-const static char DEVICE_NAME[] = "BATTERY";
-static const uint16_t uuid16_list[] = {GattService::UUID_BATTERY_SERVICE};
+DigitalOut led1(LED1, 1); //TODO LED 디바이스
+
+const static char DEVICE_NAME[] = "Color Device";
+static const uint16_t uuid16_list[] = {GattService::UUID_BATTERY_SERVICE}; //TODO 헤더 추가 바람!!!
static uint8_t batteryLevel = 50;
static BatteryService* batteryServicePtr;
static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE);
-void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
-{
+void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) {
BLE::Instance().gap().startAdvertising();
}
void updateSensorValue() {
+ //TODO 실제 센서벨류 업데이트 해야하는 부분
batteryLevel++;
if (batteryLevel > 100) {
batteryLevel = 20;
}
-
+ thermometerServicePtr->updateTemperature(currentTemperature);
batteryServicePtr->updateBatteryLevel(batteryLevel);
}
-void blinkCallback(void)
-{
+void periodicCallback(void) {
+ //TODO 연결대기 메소드
led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */
- BLE &ble = BLE::Instance();
- if (ble.gap().getState().connected) {
+ if (BLE::Instance().gap().getState().connected) {
eventQueue.call(updateSensorValue);
}
}
@@ -57,8 +41,8 @@
/**
* This function is called when the ble initialization process has failled
*/
-void onBleInitError(BLE &ble, ble_error_t error)
-{
+void onBleInitError(BLE &ble, ble_error_t error) {
+ //TODO 초기화 에러
/* Initialization error handling should go here */
}
@@ -117,7 +101,7 @@
int main()
{
- eventQueue.call_every(500, blinkCallback);
+ eventQueue.call_every(500, periodicCallback);
BLE &ble = BLE::Instance();
ble.onEventsToProcess(scheduleBleEventsProcessing);