Skip to content
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

Update flash tool, add mac os flash tool,add ipv6 get addr hook,update readme ,add board link,update ble impl, fix support phone commission #22798

Merged
merged 25 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
89dac4e
change properties of C2 Characteristic of BLE GATT to indication
wy-hh Sep 21, 2022
5bd4cba
change properties of C2 Characteristic of BLE GATT to indication for …
wy-hh Sep 21, 2022
ea11d11
update supported boards
wy-hh Sep 21, 2022
8af4c9d
[BL602] 1.Update flash tool, 2.Add ipv6 get ip hook
jczhang777 Sep 21, 2022
441270e
[BL602] Fix board led onoff
jczhang777 Sep 21, 2022
94fdde0
update README.md
wy-hh Sep 21, 2022
115a65f
Merge branch 'bl702_gatt_indication' into bl602_fix_0921
wy-hh Sep 21, 2022
2cd11fc
correct spell
wy-hh Sep 21, 2022
9389e7e
update workflow build
wy-hh Sep 21, 2022
1004526
[BL602] Update flash tool name
jczhang777 Sep 21, 2022
9d2e8cc
Merge branch 'bl602_fix_0921' of https://github.com/bouffalolab/conne…
jczhang777 Sep 21, 2022
c8c443c
Restyled by prettier-markdown
restyled-commits Sep 21, 2022
19ebbd1
[BL602] Remove not use code
jczhang777 Sep 22, 2022
d53f2f7
Restyled by clang-format
restyled-commits Sep 22, 2022
0b47ffe
[BL616] Restyled
jczhang777 Sep 22, 2022
45cadb9
Merge branch 'master' into bl602_fix_0921
wy-hh Sep 22, 2022
35ac83e
Sync ZCL State to LightingManager State setting
shchen-Lab Sep 23, 2022
e9a3a19
Restyled by clang-format
restyled-commits Sep 23, 2022
0f6154c
fix license conflict
shchen-Lab Sep 23, 2022
0484041
fix license conflict-1
shchen-Lab Sep 23, 2022
de0c6bb
fix license conflict-2
shchen-Lab Sep 23, 2022
234be15
Merge branch 'master' into bl602_fix_0921
shchen-Lab Sep 23, 2022
e67ceb6
Merge branch 'master' into bl602_fix_0921
wy-hh Sep 26, 2022
ae79216
specifiy bfbl_iot_tool version
wy-hh Sep 26, 2022
b9ad944
[BL602] Delete not use code
jczhang777 Sep 26, 2022
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
8 changes: 4 additions & 4 deletions .github/workflows/examples-bouffalolab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ jobs:
timeout-minutes: 30
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-BL706C-22-light build"
"./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-light build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py bl702 bl702 lighting-app \
out/bouffalolab-BL706-IoT-DVK-BL706C-22-light/chip-bl702-lighting-example.out /tmp/bloat_reports/
out/bouffalolab-BL706-IoT-DVK-light/chip-bl702-lighting-example.out /tmp/bloat_reports/

- name: Build example BL702 Lighting App with RPCs
timeout-minutes: 30
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-BL706C-22-light-rpc build"
"./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-light-rpc build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py bl702 bl702+rpc lighting-app \
out/bouffalolab-BL706-IoT-DVK-BL706C-22-light-rpc/chip-bl702-lighting-example.out /tmp/bloat_reports/
out/bouffalolab-BL706-IoT-DVK-light-rpc/chip-bl702-lighting-example.out /tmp/bloat_reports/

- name: Uploading Size Reports
uses: actions/upload-artifact@v2
Expand Down
3 changes: 3 additions & 0 deletions examples/lighting-app/bouffalolab/bl602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ bl602_executable("lighting_app") {
sources = [
#"${bl602_project_dir}/include/CHIPProjectConfig.h",
"${examples_plat_dir}/InitPlatform.cpp",
"${examples_plat_dir}/route_hook/bl_route_hook.c",
"${examples_plat_dir}/route_hook/bl_route_table.c",
"include/CHIPProjectConfig.h",
"src/AppTask.cpp",
"src/CHIPDeviceManager.cpp",
Expand Down Expand Up @@ -162,6 +164,7 @@ bl602_executable("lighting_app") {
include_dirs += [
"${chip_root}/examples/common",
"${chip_root}/examples/common/pigweed/bouffalolab/bl602",
"${examples_plat_dir}/route_hook",
]
}

Expand Down
5 changes: 3 additions & 2 deletions examples/lighting-app/bouffalolab/bl602/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
This example functions as a wifi light bulb device type, with on/off
capabilities. The steps were verified on BL602-IoT-Matter-V1 board.

BL602-IoT-Matter-V1 board:
BL602-IoT-Matter-V1 board and
[purchase link](https://www.amazon.com/dp/B0B9ZVGXD8):
<img src="../../../platform/bouffalolab/bl602/doc/images/BL602-IoT-Matter_V1.png" style="zoom:25%;" />

## Initial setup
Expand Down Expand Up @@ -66,7 +67,7 @@ The steps in this document were validated on Ubuntu 18.04 and 20.04.
```
cd third_party/bouffalolab/repo/tools/flash_tool

./bflb_iot_tool --chipname=BL602 --baudrate=115200 --port=/dev/ttyACM0 --pt=chips/bl602/partition/partition_cfg_4M.toml --dts=chips/bl602/device_tree/bl_factory_params_IoTKitA_40M.dts --firmware=../../../../../out/bl602-light/chip-bl602-lighting-example.bin
./bflb_iot_tool-ubuntu --chipname=BL602 --baudrate=115200 --port=/dev/ttyACM0 --pt=chips/bl602/partition/partition_cfg_4M.toml --dts=chips/bl602/device_tree/bl_factory_params_IoTKitA_40M.dts --firmware=../../../../../out/bl602-light/chip-bl602-lighting-example.bin
```

```
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/bouffalolab/bl602/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class AppTask
void PostEvent(const AppEvent * event);
void ButtonEventHandler(uint8_t btnIdx, uint8_t btnAction);
void LightStateUpdateEventHandler(void);
void LightStateInit(void);

private:
friend AppTask & GetAppTask(void);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class DLL_EXPORT CHIPDeviceManagerCallbacks
* @param size size of the attribute
* @param value pointer to the new value
*/
void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
virtual void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
uint8_t type, uint16_t size, uint8_t * value)
{}
// virtual ~CHIPDeviceManagerCallbacks();
};
Expand Down
13 changes: 13 additions & 0 deletions examples/lighting-app/bouffalolab/bl602/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ CHIP_ERROR AppTask::Init()
PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE));

InitButtons();

#if PW_RPC_ENABLED
chip::rpc::Init();
#endif
Expand Down Expand Up @@ -583,3 +584,15 @@ void AppTask::LightStateUpdateEventHandler(void)
}
} while (0);
}

void AppTask::LightStateInit(void)
{
uint8_t onoff = 1;
uint8_t level = 254;
EndpointId endpoint = 1;

emberAfWriteAttribute(endpoint, ZCL_LEVEL_CONTROL_CLUSTER_ID, ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, (uint8_t *) &level,
ZCL_INT8U_ATTRIBUTE_TYPE);

emberAfWriteAttribute(endpoint, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, (uint8_t *) &onoff, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
}
13 changes: 8 additions & 5 deletions examples/lighting-app/bouffalolab/bl602/src/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <app/util/util.h>
#include <lib/dnssd/Advertiser.h>
#include <lib/support/CodeUtils.h>
#include <route_hook/bl_route_hook.h>

using namespace ::chip;
using namespace ::chip::Inet;
Expand All @@ -47,7 +48,6 @@ uint32_t identifyTimerCount;
constexpr uint32_t kIdentifyTimerDelayMS = 250;

static LEDWidget statusLED1;
// static LEDWidget statusLED2;

void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg)
{
Expand All @@ -67,6 +67,7 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_

case DeviceEventType::kCommissioningComplete:
log_info("Commissioning complete\r\n");
GetAppTask().LightStateInit();
break;

case DeviceEventType::kWiFiConnectivityChange:
Expand All @@ -85,6 +86,12 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
// newly selected address.
chip::app::DnssdServer::Instance().StartServer();
}

if (event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV6_Assigned)
{
ChipLogProgress(DeviceLayer, "Initializing route hook...");
bl_route_hook_init();
}
break;
}
}
Expand Down Expand Up @@ -125,15 +132,11 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event
if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established)
{
log_info("IPv4 Server ready...\r\n");
// TODO
// wifiLED.Set(true);
chip::app::DnssdServer::Instance().StartServer();
}
else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost)
{
log_info("Lost IPv4 connectivity...\r\n");
// TODO
// wifiLED.Set(false);
}
if (event->InternetConnectivityChange.IPv6 == kConnectivity_Established)
{
Expand Down
62 changes: 34 additions & 28 deletions examples/lighting-app/bouffalolab/bl702/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# CHIP BL702 Lighting App Example
# CHIP BL70X Lighting App Example

## Supported Hardware
BL70X is highly integrated BLE and IEEE 802.15.4 combo chip for IoT
applications, and BL702 is a general name for BL70X family.

Current supported develop boards:
This example is powered by BL706 and functions as a Thread light bulb device
type, with on/off, level and color capabilities. The steps were verified with
following boards:

- BL702-IoT-DVK
- BL706-IoT-DVK
- BL706-NIGHT-LIGHT
> Note, please make sure both of flash and `PSRAM` shipped with develop
> board/device are at lease 2MB.
- BL706-IoT-DVK
- BL706-NIGHT-LIGHT

## Build

Expand Down Expand Up @@ -49,51 +49,57 @@ Current supported develop boards:
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK
```

- Build lighting-app for board BL702-IOT-DVK module_type is
`BL706C-22` by default. Please execute the following command to
build lighting-app for BL702-IoT-DVK with module `BL702`

```shell
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL702-IoT-DVK module_type="BL702"
```

- Build lighting-app for board BL706-NIGHT-LIGHT

```shell
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-NIGHT-LIGHT module_type="BL702"
```

> Note, please check which module is used on the board.
```shell
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-NIGHT-LIGHT
```

- With UART shell command support:
- With UART shell command enabled:

```shell
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK chip_build_libshell=true
```

- With pigweed RPC support:
- With pigweed RPC enabled:
```shell
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK 'import("//with_pw_rpc.gni")'
```
> Note, UART shell command and pigweed RPC can not build together.

- Build with `build_examples.py`

- Build for BL702-IoT-DVK, BL706-IoT-DVK and BL706-NIGHT-LIGHT as
following commands.
- Build for BL706-IoT-DVK and BL706-NIGHT-LIGHT as following commands.

```shell
./scripts/build/build_examples.py --target bouffalolab-BL702-IoT-DVK-light build
./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-BL706C-22-light build
./scripts/build/build_examples.py --target bouffalolab-BL706-NIGHT-LIGHT-light build
```

- Build with pigweed RPC support as following commands.
- Build with pigweed RPC enabled as following commands.
```shell
./scripts/build/build_examples.py --target bouffalolab-BL702-IoT-DVK-light-rpc build
./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-BL706C-22-light-rpc build
```

- Build options

- Build options list There are some build options for function and debug
purpose as below.
- `chip_build_libshell`, whether to enable shell command line. It is
set to false by default.
- `baudrate`, UART baudrate for log output or shell command line.
- `enable_psram`, whether to enable `PSRAM`. It is set to true by
default.
- How to use Before using these build options, please check whether they
are available to configure in BUILD.gn file under example application
folder.
- build with `build_examples.py` Modify value of build options in
BUILD.gn file under example application folder.
- build with gn_bouffalolab_example.sh Input build options, such as
```
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK chip_build_libshell=true
```

- Download image

- Using script `chip-bl702-lighting-example.flash.py`.
Expand Down
Loading