From e359419fe5b9ba6a890faebab70180215ff7a009 Mon Sep 17 00:00:00 2001 From: lanma Date: Sat, 19 Jan 2019 15:25:33 +0800 Subject: [PATCH 1/5] Add Arduino starter code for Linkit 7697 --- README.md | 5 ++- mt7697/README.md | 18 +++++++++ mt7697/arduino/sample/sample.ino | 67 ++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 mt7697/README.md create mode 100644 mt7697/arduino/sample/sample.ino diff --git a/README.md b/README.md index 6342786c..2148ab40 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,15 @@ 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 3 development boards +Currently LINE Things Starter firmwares supports the following 5 development boards - [Espressif ESP32-DevKitC](https://www.espressif.com/en/products/hardware/esp32-devkitc/overview) - [M5Stack (ESP32)](http://m5stack.com/) - [Adafruit Feather nRF52 Bluefruit LE](https://www.adafruit.com/product/3406) - [BBC micro:bit](https://microbit.org/) +- [Linkit 7697](https://labs.mediatek.com/zh-tw/chipset/MT7697) -Each firmware is located under、`esp32`, `m5stack`, `nrf52`, `microbit` respectively. +Each firmware is located under、`esp32`, `m5stack`, `nrf52`, `microbit` , `mt7697` respectively. For further details, please refer to the `README` file in each directory. ### Enable LINE Things diff --git a/mt7697/README.md b/mt7697/README.md new file mode 100644 index 00000000..18da135a --- /dev/null +++ b/mt7697/README.md @@ -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/zh-tw/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/zh_tw/environment-setup/setup-arduino-ide) + +## Setup +[Steps](https://docs.labs.mediatek.com/resource/linkit7697-arduino/zh_tw/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! diff --git a/mt7697/arduino/sample/sample.ino b/mt7697/arduino/sample/sample.ino new file mode 100644 index 00000000..6e684190 --- /dev/null +++ b/mt7697/arduino/sample/sample.ino @@ -0,0 +1,67 @@ +#include +#include + +#define BUTTON_PIN (6) + +int nButtonChanged = 0; +int bOn=0; +LBLEUuid serviceUuid("91E4E176-D0B9-464D-9FE4-52EE3E9F1552"); +LBLEService userService("91E4E176-D0B9-464D-9FE4-52EE3E9F1552"); +LBLECharacteristicInt writeCharacteristic("E9062E71-9E62-4BC6-B0D3-35CDCD9B027B", LBLE_WRITE); +LBLECharacteristicInt notifyCharacteristic("62FBD229-6EDD-4D1A-B554-5C4E1BB29169", LBLE_READ | LBLE_WRITE); + +LBLEService psdiService("E625601E-9E55-4597-A598-76018A0D293D"); +LBLECharacteristicInt psdiCharacteristic("26E2B12B-85F0-4F3F-9FDD-91D114270E6E", 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("LANMA"); + userService.addAttribute(writeCharacteristic); + userService.addAttribute(notifyCharacteristic); + LBLEPeripheral.addService(userService); + + psdiService.addAttribute(psdiCharacteristic); + LBLEPeripheral.addService(psdiService); + + LBLEPeripheral.begin(); + LBLEAdvertisementData advertisement; + advertisement.configAsConnectableDevice("LANMA",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); + } +} +void button_press(void){ + Serial.println("====Button Changed"); + nButtonChanged=1; +} \ No newline at end of file From 96abb7c71176e382a31ff602c1285c4f136c2a8f Mon Sep 17 00:00:00 2001 From: lanma Date: Sat, 1 Jun 2019 20:27:30 +0800 Subject: [PATCH 2/5] Resolve MT9797 pull request conversation. --- mt7697/README.md | 2 +- mt7697/arduino/sample/sample.ino | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mt7697/README.md b/mt7697/README.md index 18da135a..8082dd38 100644 --- a/mt7697/README.md +++ b/mt7697/README.md @@ -2,7 +2,7 @@ ## Requirements * [Arduino IDE](https://www.arduino.cc/en/Main/Software) -* [Linkit 7697](https://labs.mediatek.com/zh-tw/chipset/MT7697) +* [Linkit 7697](https://labs.mediatek.com/en/chipset/MT7697) * Micro-USB to USB Cable ## Installation diff --git a/mt7697/arduino/sample/sample.ino b/mt7697/arduino/sample/sample.ino index 6e684190..8d533b41 100644 --- a/mt7697/arduino/sample/sample.ino +++ b/mt7697/arduino/sample/sample.ino @@ -4,7 +4,7 @@ #define BUTTON_PIN (6) int nButtonChanged = 0; -int bOn=0; +int bOn = 0; LBLEUuid serviceUuid("91E4E176-D0B9-464D-9FE4-52EE3E9F1552"); LBLEService userService("91E4E176-D0B9-464D-9FE4-52EE3E9F1552"); LBLECharacteristicInt writeCharacteristic("E9062E71-9E62-4BC6-B0D3-35CDCD9B027B", LBLE_WRITE); @@ -24,7 +24,7 @@ void setup() { while (!LBLE.ready()) { delay(100); } - LBLEPeripheral.setName("LANMA"); + LBLEPeripheral.setName("LINE Things Trial MT7697"); userService.addAttribute(writeCharacteristic); userService.addAttribute(notifyCharacteristic); LBLEPeripheral.addService(userService); @@ -34,7 +34,7 @@ void setup() { LBLEPeripheral.begin(); LBLEAdvertisementData advertisement; - advertisement.configAsConnectableDevice("LANMA",serviceUuid); + advertisement.configAsConnectableDevice("LINE Things Trial MT7697",serviceUuid); LBLEPeripheral.advertise(advertisement); attachInterrupt(BUTTON_PIN, button_press, CHANGE); Serial.println("Ready to Connect"); @@ -43,7 +43,7 @@ void setup() { void loop() { // put your main code here, to run repeatedly: delay(20); - if(writeCharacteristic.isWritten()){ + if (writeCharacteristic.isWritten()) { bOn=writeCharacteristic.getValue(); if(bOn>0){ digitalWrite(LED_BUILTIN, HIGH); @@ -64,4 +64,4 @@ void loop() { void button_press(void){ Serial.println("====Button Changed"); nButtonChanged=1; -} \ No newline at end of file +} From 7556dfdf61c74b756d49f170faa578245a0aea93 Mon Sep 17 00:00:00 2001 From: lanma Date: Sat, 1 Jun 2019 20:43:07 +0800 Subject: [PATCH 3/5] Resolve MT9797 pull request conversation and merger from github again. --- README.md | 2 +- mt7697/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1d3829ff..4b674949 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Currently LINE Things Starter firmwares supports the following 7 development boa - [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/zh-tw/chipset/MT7697) +- [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`, `mt7697` respectively. diff --git a/mt7697/README.md b/mt7697/README.md index 8082dd38..423f7129 100644 --- a/mt7697/README.md +++ b/mt7697/README.md @@ -8,10 +8,10 @@ ## Installation Please ensure you have Arduino IDE installed and the board **disconnected**. -[Arduino IDE Setup](https://docs.labs.mediatek.com/resource/linkit7697-arduino/zh_tw/environment-setup/setup-arduino-ide) +[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/zh_tw/environment-setup/connecting-linkit-7697-to-computer) +[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 From e1b2b13068d39175248e1adef36480d269067bde Mon Sep 17 00:00:00 2001 From: lanma Date: Thu, 13 Jun 2019 14:15:08 +0800 Subject: [PATCH 4/5] Resolve MT9797 pull request conversation and merger from github 20190613. --- mt7697/arduino/sample/sample.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mt7697/arduino/sample/sample.ino b/mt7697/arduino/sample/sample.ino index 8d533b41..e1670220 100644 --- a/mt7697/arduino/sample/sample.ino +++ b/mt7697/arduino/sample/sample.ino @@ -24,7 +24,7 @@ void setup() { while (!LBLE.ready()) { delay(100); } - LBLEPeripheral.setName("LINE Things Trial MT7697"); + LBLEPeripheral.setName("MT7697"); userService.addAttribute(writeCharacteristic); userService.addAttribute(notifyCharacteristic); LBLEPeripheral.addService(userService); @@ -34,7 +34,7 @@ void setup() { LBLEPeripheral.begin(); LBLEAdvertisementData advertisement; - advertisement.configAsConnectableDevice("LINE Things Trial MT7697",serviceUuid); + advertisement.configAsConnectableDevice("MT7697",serviceUuid); LBLEPeripheral.advertise(advertisement); attachInterrupt(BUTTON_PIN, button_press, CHANGE); Serial.println("Ready to Connect"); @@ -44,24 +44,24 @@ void loop() { // put your main code here, to run repeatedly: delay(20); if (writeCharacteristic.isWritten()) { - bOn=writeCharacteristic.getValue(); - if(bOn>0){ + bOn = writeCharacteristic.getValue(); + if (bOn > 0) { digitalWrite(LED_BUILTIN, HIGH); Serial.println("LED ON"); - }else{ + } else { digitalWrite(LED_BUILTIN, LOW); Serial.println("LED OFF"); } } - if(nButtonChanged==1){ - nButtonChanged=0; + if (nButtonChanged == 1) { + nButtonChanged = 0; int btnValue = digitalRead(BUTTON_PIN); notifyCharacteristic.setValue(btnValue); LBLEPeripheral.notifyAll(notifyCharacteristic); delay(50); } } -void button_press(void){ +void button_press(void) { Serial.println("====Button Changed"); - nButtonChanged=1; + nButtonChanged = 1; } From f0245ddf254d21988b7887afb2a833b794ab1cc7 Mon Sep 17 00:00:00 2001 From: lanma Date: Sun, 16 Jun 2019 23:16:05 +0800 Subject: [PATCH 5/5] Update README.md Co-Authored-By: Hirotaka Kawata --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b674949..67e66df9 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Currently LINE Things Starter firmwares supports the following 7 development boa - [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`, `mt7697` 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