Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / pigweed-app / efr32 / src / main.cpp
1 /*
2  *
3  *    Copyright (c) 2021 Project CHIP Authors
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 #include "AppConfig.h"
19 #include "LEDWidget.h"
20 #include "init_efrPlatform.h"
21
22 #include "pw_rpc/echo_service_nanopb.h"
23 #include "pw_sys_io/sys_io.h"
24 #include "pw_sys_io_efr32/init.h"
25 #include "uart.h"
26
27 #include "PigweedLoggerMutex.h"
28 #include "pigweed/RpcService.h"
29 #include <FreeRTOS.h>
30 #include <task.h>
31
32 static LEDWidget sStatusLED;
33
34 namespace {
35 using std::byte;
36
37 #define RPC_TASK_STACK_SIZE 4096
38 #define RPC_TASK_PRIORITY 2
39 static TaskHandle_t sRpcTaskHandle;
40
41 pw::rpc::EchoService echo_service;
42
43 void RegisterServices(pw::rpc::Server & server)
44 {
45     server.RegisterService(echo_service);
46 }
47
48 void RunRpcService(void *)
49 {
50     Start(RegisterServices, &::chip::rpc::logger_mutex);
51 }
52
53 } // namespace
54
55 int main(void)
56 {
57     init_efrPlatform();
58     EFR32_LOG("***** CHIP EFR32 pigweed example *****\r\n");
59
60     pw_sys_io_Init();
61     // Initialize LEDs
62     LEDWidget::InitGpio();
63     sStatusLED.Init(SYSTEM_STATE_LED);
64     sStatusLED.Set(true);
65
66     xTaskCreate(RunRpcService, "RPC_Task", RPC_TASK_STACK_SIZE / sizeof(StackType_t), nullptr, RPC_TASK_PRIORITY, &sRpcTaskHandle);
67
68     vTaskStartScheduler();
69 }