-
Notifications
You must be signed in to change notification settings - Fork 404
Add "Mediatek MT7697" support #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
e359419
0b21383
96abb7c
f42702d
7556dfd
e1b2b13
f0245dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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! |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||
| #include <LBLE.h> | ||||||||
| #include <LBLEPeriphral.h> | ||||||||
|
|
||||||||
| #define BUTTON_PIN (6) | ||||||||
|
|
||||||||
| int nButtonChanged = 0; | ||||||||
| int bOn = 0; | ||||||||
| LBLEUuid serviceUuid("91E4E176-D0B9-464D-9FE4-52EE3E9F1552"); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| LBLEService userService("91E4E176-D0B9-464D-9FE4-52EE3E9F1552"); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| LBLECharacteristicInt writeCharacteristic("E9062E71-9E62-4BC6-B0D3-35CDCD9B027B", LBLE_WRITE); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| LBLEService psdiService("E625601E-9E55-4597-A598-76018A0D293D"); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| LBLECharacteristicInt psdiCharacteristic("26E2B12B-85F0-4F3F-9FDD-91D114270E6E", LBLE_READ); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to set PSDI as unique device id.
Suggested change
|
||||||||
|
|
||||||||
| 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); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set actual PSDI
Suggested change
|
||||||||
|
|
||||||||
| LBLEPeripheral.begin(); | ||||||||
| LBLEAdvertisementData advertisement; | ||||||||
| advertisement.configAsConnectableDevice("MT7697",serviceUuid); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| 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); | ||||||||
| } | ||||||||
| } | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| void button_press(void) { | ||||||||
| Serial.println("====Button Changed"); | ||||||||
| nButtonChanged = 1; | ||||||||
| } | ||||||||
There was a problem hiding this comment.
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