Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ To start developing for LINE Things using the example code and the sample firmwa
### Installing the Firmware

To start development using the example firmwares, you will need a compatible Bluetooth LE enabled development board.
Currently LINE Things Starter firmwares supports the following 6 development boards
Currently LINE Things Starter firmwares supports the following 7 development boards

- [LINE Things dev board](https://github.com/line/line-things-dev-board)
- [Espressif ESP32-DevKitC](https://www.espressif.com/en/products/hardware/esp32-devkitc/overview)
- [M5Stack (ESP32)](http://m5stack.com/)
- [Adafruit Feather nRF52 Bluefruit LE - nRF52832](https://www.adafruit.com/product/3406)
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
- [BBC micro:bit](https://microbit.org/)
- [Linkit 7697](https://labs.mediatek.com/en/chipset/MT7697)
- [Obniz](https://obniz.io/)

Each firmware is located under、`line-things-dev-board`, `esp32`, `m5stack`, `nrf52`, `microbit`, `obniz` respectively.
Each firmware is located under、`line-things-dev-board`, `esp32`, `m5stack`, `nrf52`, `microbit`, `mt7697`, `obniz` respectively.
For further details, please refer to the `README` file in each directory.

### Enable LINE Things
Expand Down
18 changes: 18 additions & 0 deletions mt7697/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# LINE Things Starter for Linkit 7697

## Requirements
* [Arduino IDE](https://www.arduino.cc/en/Main/Software)
* [Linkit 7697](https://labs.mediatek.com/en/chipset/MT7697)
* Micro-USB to USB Cable

## Installation
Please ensure you have Arduino IDE installed and the board **disconnected**.

[Arduino IDE Setup](https://docs.labs.mediatek.com/resource/linkit7697-arduino/en/environment-setup/setup-arduino-ide)

## Setup
[Steps](https://docs.labs.mediatek.com/resource/linkit7697-arduino/en/environment-setup/connecting-linkit-7697-to-computer)
## Upload
1. From this repository, open **arduino/sample/sample.ino**
2. Change the `USER_SERVICE_UUID` to your generated UUID
3. Upload and Enjoy!
67 changes: 67 additions & 0 deletions mt7697/arduino/sample/sample.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include <LBLE.h>
#include <LBLEPeriphral.h>

#define BUTTON_PIN (6)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make uniform as other sketches

Suggested change
#define BUTTON_PIN (6)
// User service UUID: Change this to your generated service UUID
#define USER_SERVICE_UUID "91E4E176-D0B9-464D-9FE4-52EE3E9F1552"
// User service characteristics
#define WRITE_CHARACTERISTIC_UUID "E9062E71-9E62-4BC6-B0D3-35CDCD9B027B"
#define NOTIFY_CHARACTERISTIC_UUID "62FBD229-6EDD-4D1A-B554-5C4E1BB29169"
// PSDI Service UUID: Fixed value for Developer Trial
#define PSDI_SERVICE_UUID "E625601E-9E55-4597-A598-76018A0D293D"
#define PSDI_CHARACTERISTIC_UUID "26E2B12B-85F0-4F3F-9FDD-91D114270E6E"
#define BUTTON_PIN (6)


int nButtonChanged = 0;
int bOn = 0;
LBLEUuid serviceUuid("91E4E176-D0B9-464D-9FE4-52EE3E9F1552");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LBLEUuid serviceUuid("91E4E176-D0B9-464D-9FE4-52EE3E9F1552");
LBLEUuid serviceUuid(USER_SERVICE_UUID);

LBLEService userService("91E4E176-D0B9-464D-9FE4-52EE3E9F1552");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LBLEService userService("91E4E176-D0B9-464D-9FE4-52EE3E9F1552");
LBLEService userService(USER_SERVICE_UUID);

LBLECharacteristicInt writeCharacteristic("E9062E71-9E62-4BC6-B0D3-35CDCD9B027B", LBLE_WRITE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LBLECharacteristicInt writeCharacteristic("E9062E71-9E62-4BC6-B0D3-35CDCD9B027B", LBLE_WRITE);
LBLECharacteristicInt writeCharacteristic(WRITE_CHARACTERISTIC_UUID, LBLE_WRITE);

LBLECharacteristicInt notifyCharacteristic("62FBD229-6EDD-4D1A-B554-5C4E1BB29169", LBLE_READ | LBLE_WRITE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LBLECharacteristicInt notifyCharacteristic("62FBD229-6EDD-4D1A-B554-5C4E1BB29169", LBLE_READ | LBLE_WRITE);
LBLECharacteristicInt notifyCharacteristic(NOTIFY_CHARACTERISTIC_UUID, LBLE_READ | LBLE_WRITE);


LBLEService psdiService("E625601E-9E55-4597-A598-76018A0D293D");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LBLEService psdiService("E625601E-9E55-4597-A598-76018A0D293D");
LBLEService psdiService(PSDI_SERVICE_UUID);

LBLECharacteristicInt psdiCharacteristic("26E2B12B-85F0-4F3F-9FDD-91D114270E6E", LBLE_READ);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to set PSDI as unique device id.
I will use LBLE.getDeviceAddress().toString() for PSDI.

Suggested change
LBLECharacteristicInt psdiCharacteristic("26E2B12B-85F0-4F3F-9FDD-91D114270E6E", LBLE_READ);
LBLECharacteristicString psdiCharacteristic(PSDI_CHARACTERISTIC_UUID, LBLE_READ);


void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
LBLE.begin();
while (!LBLE.ready()) {
delay(100);
}
LBLEPeripheral.setName("MT7697");
userService.addAttribute(writeCharacteristic);
userService.addAttribute(notifyCharacteristic);
LBLEPeripheral.addService(userService);

psdiService.addAttribute(psdiCharacteristic);
LBLEPeripheral.addService(psdiService);

@hktechn0 hktechn0 Jun 13, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set actual PSDI

Suggested change
LBLEPeripheral.addService(psdiService);
LBLEPeripheral.addService(psdiService);
psdiCharacteristic.setValue(LBLE.getDeviceAddress().toString());


LBLEPeripheral.begin();
LBLEAdvertisementData advertisement;
advertisement.configAsConnectableDevice("MT7697",serviceUuid);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
advertisement.configAsConnectableDevice("MT7697",serviceUuid);
advertisement.configAsConnectableDevice("MT7697", serviceUuid);

LBLEPeripheral.advertise(advertisement);
attachInterrupt(BUTTON_PIN, button_press, CHANGE);
Serial.println("Ready to Connect");
}

void loop() {
// put your main code here, to run repeatedly:
delay(20);
if (writeCharacteristic.isWritten()) {
bOn = writeCharacteristic.getValue();
if (bOn > 0) {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("LED ON");
} else {
digitalWrite(LED_BUILTIN, LOW);
Serial.println("LED OFF");
}
}
if (nButtonChanged == 1) {
nButtonChanged = 0;
int btnValue = digitalRead(BUTTON_PIN);
notifyCharacteristic.setValue(btnValue);
LBLEPeripheral.notifyAll(notifyCharacteristic);
delay(50);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

void button_press(void) {
Serial.println("====Button Changed");
nButtonChanged = 1;
}