samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to return 'int', adapt that for Zephyr to align with those standard. This also eliminates errors when building with clang when not using -ffreestanding, and reduces the need for compiler flags to silence warnings for both clang and gcc. Most of these changes were automated using coccinelle with the following script: @@ @@ - void + int main(...) { ... - return; + return 0; ... } Approximately 40 files had to be edited by hand as coccinelle was unable to fix them. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
fc076f5a1d
commit
0b90fd5adf
447 changed files with 1617 additions and 1231 deletions
|
@ -8,11 +8,12 @@
|
|||
|
||||
extern void wakeup_cpu1(void);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
/* Simply wake-up the remote core */
|
||||
wakeup_cpu1();
|
||||
|
||||
while (1) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -332,11 +332,7 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
|
|||
z_mem_manage_boot_finish();
|
||||
#endif /* CONFIG_MMU */
|
||||
|
||||
#ifdef CONFIG_CPP_MAIN
|
||||
extern int main(void);
|
||||
#else
|
||||
extern void main(void);
|
||||
#endif
|
||||
|
||||
(void)main();
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void disable_mpu_rasr_xn(void)
|
|||
extern void function_in_ext_flash(void);
|
||||
extern void function_in_sram(void);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
#ifdef CONFIG_ARM_MPU
|
||||
disable_mpu_rasr_xn();
|
||||
|
@ -54,4 +54,5 @@ void main(void)
|
|||
function_in_sram();
|
||||
|
||||
printk("Hello World! %s\n", CONFIG_BOARD);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
|
||||
#include <mylib.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello World!\n");
|
||||
mylib_hello_world();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("Hello World! %s\n", CONFIG_ARCH);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ static void user_entry(void *p1, void *p2, void *p3)
|
|||
hello_world_print(dev);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("Hello World from the app!\n");
|
||||
|
||||
|
@ -27,4 +27,5 @@ void main(void)
|
|||
|
||||
k_object_access_grant(dev, k_current_get());
|
||||
k_thread_user_mode_enter(user_entry, NULL, NULL, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/linker/linker-defs.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("Address of sample %p\n", (void *)__rom_region_start);
|
||||
printk("Hello sysbuild with mcuboot! %s\n", CONFIG_BOARD);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -139,15 +139,16 @@ static int cmd_mtest(const struct shell *shell, size_t argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
#if defined(CONFIG_SOC_FLASH_MCUX) || defined(CONFIG_SOC_FLASH_LPC) || \
|
||||
defined(CONFIG_SOC_FLASH_STM32)
|
||||
if (!device_is_ready(flash_dev)) {
|
||||
printk("Flash device not ready\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(sub_mpu,
|
||||
|
|
|
@ -77,7 +77,7 @@ void test_thread(void *arg1, void *arg2, void *arg3)
|
|||
atomic_dec(counter);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t start_time, stop_time, cycles_spent, nanoseconds_spent;
|
||||
int i;
|
||||
|
@ -112,4 +112,5 @@ void main(void)
|
|||
|
||||
printk("All %d threads executed by %d cores in %d msec\n", THREADS_NUM,
|
||||
CORES_NUM, nanoseconds_spent / 1000 / 1000);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ void queue_thread(void *arg1, void *arg2, void *arg3)
|
|||
k_mutex_unlock(&fetch_queue_mtx);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t start_time, stop_time, cycles_spent, nanoseconds_spent;
|
||||
|
||||
|
@ -201,4 +201,5 @@ void main(void)
|
|||
}
|
||||
|
||||
k_sleep(K_MSEC(10));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,24 +19,25 @@
|
|||
*/
|
||||
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!gpio_is_ready_dt(&led)) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
ret = gpio_pin_toggle_dt(&led);
|
||||
if (ret < 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
k_msleep(SLEEP_TIME_MS);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ static const struct pwm_dt_spec pwm_led0 = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
|
|||
#define MIN_PERIOD PWM_SEC(1U) / 128U
|
||||
#define MAX_PERIOD PWM_SEC(1U)
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t max_period;
|
||||
uint32_t period;
|
||||
|
@ -31,7 +31,7 @@ void main(void)
|
|||
if (!device_is_ready(pwm_led0.dev)) {
|
||||
printk("Error: PWM device %s is not ready\n",
|
||||
pwm_led0.dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -49,7 +49,7 @@ void main(void)
|
|||
printk("Error: PWM device "
|
||||
"does not support a period at least %lu\n",
|
||||
4U * MIN_PERIOD);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ void main(void)
|
|||
ret = pwm_set_dt(&pwm_led0, period, period / 2U);
|
||||
if (ret) {
|
||||
printk("Error %d: failed to set pulse width\n", ret);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
period = dir ? (period * 2U) : (period / 2U);
|
||||
|
@ -75,4 +75,5 @@ void main(void)
|
|||
|
||||
k_sleep(K_SECONDS(4U));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -38,21 +38,21 @@ void button_pressed(const struct device *dev, struct gpio_callback *cb,
|
|||
printk("Button pressed at %" PRIu32 "\n", k_cycle_get_32());
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!gpio_is_ready_dt(&button)) {
|
||||
printk("Error: button device %s is not ready\n",
|
||||
button.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure_dt(&button, GPIO_INPUT);
|
||||
if (ret != 0) {
|
||||
printk("Error %d: failed to configure %s pin %d\n",
|
||||
ret, button.port->name, button.pin);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_interrupt_configure_dt(&button,
|
||||
|
@ -60,7 +60,7 @@ void main(void)
|
|||
if (ret != 0) {
|
||||
printk("Error %d: failed to configure interrupt on %s pin %d\n",
|
||||
ret, button.port->name, button.pin);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin));
|
||||
|
@ -95,4 +95,5 @@ void main(void)
|
|||
k_msleep(SLEEP_TIME_MS);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
static const struct gpio_dt_spec load_switch =
|
||||
GPIO_DT_SPEC_GET_OR(DT_NODELABEL(load_switch), gpios, {0});
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!gpio_is_ready_dt(&load_switch)) {
|
||||
printf("The load switch pin GPIO port is not ready.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Initializing pin with inactive level.\n");
|
||||
|
@ -31,7 +31,7 @@ void main(void)
|
|||
err = gpio_pin_configure_dt(&load_switch, GPIO_OUTPUT_INACTIVE);
|
||||
if (err != 0) {
|
||||
printf("Configuring GPIO pin failed: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Waiting one second.\n");
|
||||
|
@ -44,4 +44,5 @@ void main(void)
|
|||
if (err != 0) {
|
||||
printf("Setting GPIO pin level failed: %d\n", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ static const struct pwm_dt_spec pwm_led0 = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
|
|||
#define NUM_STEPS 50U
|
||||
#define SLEEP_MSEC 25U
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t pulse_width = 0U;
|
||||
uint32_t step = pwm_led0.period / NUM_STEPS;
|
||||
|
@ -31,14 +31,14 @@ void main(void)
|
|||
if (!device_is_ready(pwm_led0.dev)) {
|
||||
printk("Error: PWM device %s is not ready\n",
|
||||
pwm_led0.dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
ret = pwm_set_pulse_dt(&pwm_led0, pulse_width);
|
||||
if (ret) {
|
||||
printk("Error %d: failed to set pulse width\n", ret);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
|
@ -58,4 +58,5 @@ void main(void)
|
|||
|
||||
k_sleep(K_MSEC(SLEEP_MSEC));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ struct _stats {
|
|||
|
||||
static void print_stats(const struct _stats *stats);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
size_t i;
|
||||
int ires;
|
||||
|
@ -89,9 +89,7 @@ out:
|
|||
|
||||
LOG_INF("success");
|
||||
|
||||
if (IS_ENABLED(CONFIG_ARCH_POSIX)) {
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void print_stats(const struct _stats *stats)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ static const struct pwm_dt_spec blue_pwm_led =
|
|||
|
||||
#define STEP_SIZE PWM_USEC(2000)
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t pulse_red, pulse_green, pulse_blue; /* pulse widths */
|
||||
int ret;
|
||||
|
@ -33,7 +33,7 @@ void main(void)
|
|||
!device_is_ready(green_pwm_led.dev) ||
|
||||
!device_is_ready(blue_pwm_led.dev)) {
|
||||
printk("Error: one or more PWM devices not ready\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -42,7 +42,7 @@ void main(void)
|
|||
ret = pwm_set_pulse_dt(&red_pwm_led, pulse_red);
|
||||
if (ret != 0) {
|
||||
printk("Error %d: red write failed\n", ret);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (pulse_green = 0U;
|
||||
|
@ -53,7 +53,7 @@ void main(void)
|
|||
if (ret != 0) {
|
||||
printk("Error %d: green write failed\n",
|
||||
ret);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (pulse_blue = 0U;
|
||||
|
@ -65,11 +65,12 @@ void main(void)
|
|||
printk("Error %d: "
|
||||
"blue write failed\n",
|
||||
ret);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
k_sleep(K_SECONDS(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ enum direction {
|
|||
UP,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t pulse_width = min_pulse;
|
||||
enum direction dir = UP;
|
||||
|
@ -34,14 +34,14 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(servo.dev)) {
|
||||
printk("Error: PWM device %s is not ready\n", servo.dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
ret = pwm_set_pulse_dt(&servo, pulse_width);
|
||||
if (ret < 0) {
|
||||
printk("Error %d: failed to set pulse width\n", ret);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dir == DOWN) {
|
||||
|
@ -62,4 +62,5 @@ void main(void)
|
|||
|
||||
k_sleep(K_SECONDS(1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ static struct sys_heap heap;
|
|||
|
||||
void print_sys_memory_stats(void);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
void *p;
|
||||
|
||||
|
@ -31,6 +31,7 @@ void main(void)
|
|||
|
||||
sys_heap_free(&heap, p);
|
||||
print_sys_memory_stats();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_sys_memory_stats(void)
|
||||
|
|
|
@ -74,7 +74,7 @@ static void bt_ready(int err)
|
|||
printk("Beacon started, advertising as %s\n", addr_s);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -85,4 +85,5 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -580,14 +580,14 @@ static int stop_adv(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = init();
|
||||
if (err) {
|
||||
printk("Init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (size_t i = 0U; i < ARRAY_SIZE(streams_p); i++) {
|
||||
|
@ -646,7 +646,7 @@ void main(void)
|
|||
if (err != 0 && err != -EALREADY) {
|
||||
printk("Unable to start scan for broadcast sources: %d\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = k_sem_take(&sem_broadcaster_found, SEM_TIMEOUT);
|
||||
|
@ -700,10 +700,11 @@ wait_for_pa_sync:
|
|||
streams_p, sink_broadcast_code);
|
||||
if (err != 0) {
|
||||
printk("Unable to sync to broadcast source: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Waiting for PA disconnected\n");
|
||||
k_sem_take(&sem_pa_sync_lost, K_FOREVER);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_ext_adv *adv;
|
||||
int err;
|
||||
|
@ -138,7 +138,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Bluetooth initialized\n");
|
||||
|
||||
|
@ -161,7 +161,7 @@ void main(void)
|
|||
if (err != 0) {
|
||||
printk("Unable to create extended advertising set: %d\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set periodic advertising parameters */
|
||||
|
@ -169,20 +169,20 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to set periodic advertising parameters"
|
||||
" (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Creating broadcast source\n");
|
||||
err = setup_broadcast_source(&broadcast_source);
|
||||
if (err != 0) {
|
||||
printk("Unable to setup broadcast source: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_bap_broadcast_source_get_id(broadcast_source, &broadcast_id);
|
||||
if (err != 0) {
|
||||
printk("Unable to get broadcast ID: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Setup extended advertising data */
|
||||
|
@ -195,14 +195,14 @@ void main(void)
|
|||
if (err != 0) {
|
||||
printk("Failed to set extended advertising data: %d\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Setup periodic advertising data */
|
||||
err = bt_bap_broadcast_source_get_base(broadcast_source, &base_buf);
|
||||
if (err != 0) {
|
||||
printk("Failed to get encoded BASE: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
per_ad.type = BT_DATA_SVC_DATA16;
|
||||
|
@ -212,7 +212,7 @@ void main(void)
|
|||
if (err != 0) {
|
||||
printk("Failed to set periodic advertising data: %d\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Start extended advertising */
|
||||
|
@ -220,7 +220,7 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to start extended advertising: %d\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enable Periodic Advertising */
|
||||
|
@ -228,7 +228,7 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to enable periodic advertising: %d\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Starting broadcast source\n");
|
||||
|
@ -236,7 +236,7 @@ void main(void)
|
|||
err = bt_bap_broadcast_source_start(broadcast_source, adv);
|
||||
if (err != 0) {
|
||||
printk("Unable to start broadcast source: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wait for all to be started */
|
||||
|
@ -261,7 +261,7 @@ void main(void)
|
|||
err = bt_bap_broadcast_source_stop(broadcast_source);
|
||||
if (err != 0) {
|
||||
printk("Unable to stop broadcast source: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wait for all to be stopped */
|
||||
|
@ -274,7 +274,7 @@ void main(void)
|
|||
err = bt_bap_broadcast_source_delete(broadcast_source);
|
||||
if (err != 0) {
|
||||
printk("Unable to delete broadcast source: %d\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Broadcast source deleted\n");
|
||||
broadcast_source = NULL;
|
||||
|
@ -284,21 +284,22 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to stop periodic advertising (err %d)\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_le_ext_adv_stop(adv);
|
||||
if (err) {
|
||||
printk("Failed to stop extended advertising (err %d)\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_le_ext_adv_delete(adv);
|
||||
if (err) {
|
||||
printk("Failed to delete extended advertising (err %d)\n",
|
||||
err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ static const struct bt_data ad[] = {
|
|||
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 3),
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -30,7 +30,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -45,7 +45,7 @@ void main(void)
|
|||
NULL, 0);
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
k_msleep(1000);
|
||||
|
@ -53,10 +53,11 @@ void main(void)
|
|||
err = bt_le_adv_stop();
|
||||
if (err) {
|
||||
printk("Advertising failed to stop (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
mfg_data[2]++;
|
||||
|
||||
} while (1);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
|
||||
int broadcaster_multiple(void);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("Starting Multiple Broadcaster Demo\n");
|
||||
|
||||
(void)broadcaster_multiple();
|
||||
|
||||
printk("Exiting %s thread.\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -121,17 +121,18 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
||||
start_scan();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
extern uint32_t central_gatt_write(uint32_t count);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
(void)central_gatt_write(0U);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -240,17 +240,18 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
err = bt_enable(NULL);
|
||||
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
||||
start_scan();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -263,14 +263,14 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -279,8 +279,9 @@ void main(void)
|
|||
|
||||
if (err) {
|
||||
printk("Scanning failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Scanning successfully started\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
struct bt_iso_chan *channels[1];
|
||||
|
@ -228,7 +228,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_SETTINGS)) {
|
||||
|
@ -257,10 +257,11 @@ void main(void)
|
|||
|
||||
if (err != 0) {
|
||||
printk("Failed to create CIG (%d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
start_scan();
|
||||
|
||||
k_work_init_delayable(&iso_send_work, iso_timer_timeout);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
int init_central(uint8_t iterations);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
(void)init_central(CONFIG_SAMPLE_CONN_ITERATIONS);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -645,7 +645,7 @@ static void bt_otc_init(void)
|
|||
bt_ots_client_register(&otc);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -659,11 +659,12 @@ void main(void)
|
|||
|
||||
if (err != 0) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_otc_init();
|
||||
printk("Bluetooth OTS client sample running\n");
|
||||
|
||||
start_scan();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ static struct bt_le_per_adv_sync_cb sync_callbacks = {
|
|||
.recv = recv_cb
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_per_adv_sync_param sync_create_param;
|
||||
struct bt_le_per_adv_sync *sync;
|
||||
|
@ -241,7 +241,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err != 0) {
|
||||
printk("failed to enable BT (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Connection callbacks register\n");
|
||||
|
@ -257,7 +257,7 @@ void main(void)
|
|||
err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, NULL);
|
||||
if (err != 0) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -266,7 +266,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_conn, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("Could not take sem_conn (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Connected.\n");
|
||||
|
||||
|
@ -275,7 +275,7 @@ void main(void)
|
|||
err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, NULL);
|
||||
if (err != 0) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Scan started.\n");
|
||||
|
||||
|
@ -283,7 +283,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_adv, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("Could not take sem_per_adv (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Found periodic advertising.\n");
|
||||
|
||||
|
@ -297,7 +297,7 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_create(&sync_create_param, &sync);
|
||||
if (err != 0) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -305,7 +305,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_sync, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Periodic sync established.\n");
|
||||
|
||||
|
@ -313,14 +313,14 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_transfer(sync, default_conn, 0);
|
||||
if (err != 0) {
|
||||
printk("Could not transfer sync (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Waiting for connection lost...\n");
|
||||
err = k_sem_take(&sem_conn_lost, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("Could not take sem_conn_lost (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Connection lost.\n");
|
||||
} while (true);
|
||||
|
|
|
@ -149,14 +149,14 @@ static struct bt_conn_auth_info_cb bt_conn_auth_info = {
|
|||
.pairing_complete = pairing_complete
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -165,4 +165,5 @@ void main(void)
|
|||
while (1) {
|
||||
k_sleep(K_FOREVER);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -283,17 +283,18 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.cte_report_cb = cte_recv_cb,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
||||
start_scan();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ static void scan_disable(void)
|
|||
scan_enabled = false;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -388,7 +388,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_adv, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success. Found periodic advertising.\n");
|
||||
|
||||
|
@ -410,7 +410,7 @@ void main(void)
|
|||
|
||||
err = delete_sync();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
@ -427,8 +427,9 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_sync_lost, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Periodic sync lost.\n");
|
||||
} while (true);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ static void adv_sent_cb(struct bt_le_ext_adv *adv,
|
|||
adv, info->num_sent);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
char addr_s[BT_ADDR_LE_STR_LEN];
|
||||
struct bt_le_oob oob_local;
|
||||
|
@ -85,7 +85,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -93,7 +93,7 @@ void main(void)
|
|||
err = bt_le_ext_adv_create(¶m, &adv_callbacks, &adv_set);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -101,7 +101,7 @@ void main(void)
|
|||
err = bt_df_set_adv_cte_tx_param(adv_set, &cte_params);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -109,7 +109,7 @@ void main(void)
|
|||
err = bt_le_per_adv_set_param(adv_set, &per_adv_param);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -117,7 +117,7 @@ void main(void)
|
|||
err = bt_df_adv_cte_tx_enable(adv_set);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -125,7 +125,7 @@ void main(void)
|
|||
err = bt_le_per_adv_start(adv_set);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -133,7 +133,7 @@ void main(void)
|
|||
err = bt_le_ext_adv_start(adv_set, &ext_adv_start_param);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
|
@ -141,11 +141,12 @@ void main(void)
|
|||
err = bt_le_ext_adv_oob_get_local(adv_set, &oob_local);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success\n");
|
||||
|
||||
bt_addr_le_to_str(&oob_local.addr, addr_s, sizeof(addr_s));
|
||||
|
||||
printk("Started extended advertising as %s\n", addr_s);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -108,15 +108,16 @@ static void bt_ready(void)
|
|||
printk("Advertising successfully started\n");
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -681,7 +681,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -692,4 +692,5 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ static void handsfree_enable(void)
|
|||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -124,4 +124,5 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -148,14 +148,14 @@ BT_IAS_CB_DEFINE(ias_callbacks) = {
|
|||
};
|
||||
#endif /* CONFIG_BT_IAS */
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err != 0) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -163,40 +163,40 @@ void main(void)
|
|||
err = has_server_init();
|
||||
if (err != 0) {
|
||||
printk("HAS Server init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bap_unicast_sr_init();
|
||||
if (err != 0) {
|
||||
printk("BAP Unicast Server init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_HAP_HA_HEARING_AID_BINAURAL)) {
|
||||
err = csip_set_member_init();
|
||||
if (err != 0) {
|
||||
printk("CSIP Set Member init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = csip_generate_rsi(csis_rsi_addata);
|
||||
if (err != 0) {
|
||||
printk("Failed to generate RSI (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
err = vcp_vol_renderer_init();
|
||||
if (err != 0) {
|
||||
printk("VCP Volume Renderer init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_ASCS_ASE_SRC)) {
|
||||
err = micp_mic_dev_init();
|
||||
if (err != 0) {
|
||||
printk("MICP Microphone Device init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ void main(void)
|
|||
err = ccp_call_ctrl_init();
|
||||
if (err != 0) {
|
||||
printk("MICP Microphone Device init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,4 +234,5 @@ void main(void)
|
|||
|
||||
k_work_init_delayable(&adv_work, adv_work_handler);
|
||||
k_work_schedule(&adv_work, K_NO_WAIT);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ void modulate_tx_power(void *p1, void *p2, void *p3)
|
|||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int8_t txp_get = 0xFF;
|
||||
int err;
|
||||
|
@ -312,4 +312,5 @@ void main(void)
|
|||
hrs_notify();
|
||||
k_sleep(K_SECONDS(2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ static struct ipc_ept_cfg hci_ept_cfg = {
|
|||
},
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
const struct device *hci_ipc_instance =
|
||||
|
@ -396,4 +396,5 @@ void main(void)
|
|||
buf = net_buf_get(&rx_queue, K_FOREVER);
|
||||
hci_rpmsg_send(buf, HCI_REGULAR_MSG);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ static int hci_spi_init(void)
|
|||
|
||||
SYS_INIT(hci_spi_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
static K_FIFO_DEFINE(rx_queue);
|
||||
struct bt_hci_evt_hdr *evt_hdr;
|
||||
|
@ -293,7 +293,7 @@ void main(void)
|
|||
err = bt_enable_raw(&rx_queue);
|
||||
if (err) {
|
||||
LOG_ERR("bt_enable_raw: %d; aborting", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Spawn the TX thread, which feeds cmds and data to the controller */
|
||||
|
@ -313,7 +313,7 @@ void main(void)
|
|||
if (err) {
|
||||
LOG_ERR("can't send initialization event; aborting");
|
||||
k_thread_abort(tx_id);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -323,4 +323,5 @@ void main(void)
|
|||
LOG_ERR("Failed to send");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ static int hci_uart_init(void)
|
|||
|
||||
SYS_INIT(hci_uart_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
/* incoming events and data from the controller */
|
||||
static K_FIFO_DEFINE(rx_queue);
|
||||
|
@ -409,4 +409,5 @@ void main(void)
|
|||
LOG_ERR("Failed to send");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ static int enable_usb_device_next(void)
|
|||
}
|
||||
#endif /* CONFIG_USB_DEVICE_STACK_NEXT */
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -83,8 +83,9 @@ void main(void)
|
|||
|
||||
if (ret != 0) {
|
||||
printk("Failed to enable USB");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth over USB sample\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,15 +8,16 @@
|
|||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/usb/usb_device.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = usb_enable(NULL);
|
||||
if (ret != 0) {
|
||||
printk("Failed to enable USB");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth H:4 over USB sample\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ static void bt_ready(int err)
|
|||
printk("iBeacon started\n");
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -71,4 +71,5 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -308,11 +308,12 @@ static void listen(void)
|
|||
net_context_put(tcp_recv6);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
init_app();
|
||||
|
||||
k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)listen,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ static struct bt_iso_big_create_param big_create_param = {
|
|||
.framing = 0, /* 0 - unframed, 1 - framed */
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t timeout_counter = INITIAL_TIMEOUT_COUNTER;
|
||||
struct bt_le_ext_adv *adv;
|
||||
|
@ -89,14 +89,14 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create a non-connectable non-scannable advertising set */
|
||||
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN_NAME, NULL, &adv);
|
||||
if (err) {
|
||||
printk("Failed to create advertising set (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set periodic advertising parameters */
|
||||
|
@ -104,28 +104,28 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to set periodic advertising parameters"
|
||||
" (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enable Periodic Advertising */
|
||||
err = bt_le_per_adv_start(adv);
|
||||
if (err) {
|
||||
printk("Failed to enable periodic advertising (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Start extended advertising */
|
||||
err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
|
||||
if (err) {
|
||||
printk("Failed to start extended advertising (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create BIG */
|
||||
err = bt_iso_big_create(adv, &big_create_param, &big);
|
||||
if (err) {
|
||||
printk("Failed to create BIG (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint8_t chan = 0U; chan < BIS_ISO_CHAN_COUNT; chan++) {
|
||||
|
@ -133,7 +133,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_big_cmplt, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("BIG create complete chan %u.\n", chan);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ void main(void)
|
|||
if (!buf) {
|
||||
printk("Data buffer allocate timeout on channel"
|
||||
" %u\n", chan);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE);
|
||||
sys_put_le32(iso_send_count, iso_data);
|
||||
|
@ -162,7 +162,7 @@ void main(void)
|
|||
printk("Unable to broadcast data on channel %u"
|
||||
" : %d", chan, ret);
|
||||
net_buf_unref(buf);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ void main(void)
|
|||
err = bt_iso_big_terminate(big);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -193,7 +193,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_big_term, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("BIG terminate complete chan %u.\n",
|
||||
chan);
|
||||
|
@ -203,7 +203,7 @@ void main(void)
|
|||
err = bt_iso_big_create(adv, &big_create_param, &big);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -214,7 +214,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_big_cmplt, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("BIG create complete chan %u.\n", chan);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static enum benchmark_role device_role_select(void)
|
|||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
enum benchmark_role role;
|
||||
|
@ -60,13 +60,13 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err != 0) {
|
||||
LOG_INF("Bluetooth init failed (err %d)", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = console_init();
|
||||
if (err != 0) {
|
||||
LOG_INF("Console init failed (err %d)", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_INF("Bluetooth initialized");
|
||||
|
@ -93,4 +93,5 @@ void main(void)
|
|||
}
|
||||
|
||||
LOG_INF("Exiting");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1080,7 +1080,7 @@ static int run_peripheral(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err != 0) {
|
||||
LOG_ERR("Bluetooth init failed: %d", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_conn_cb_register(&conn_callbacks);
|
||||
|
@ -1098,7 +1098,7 @@ void main(void)
|
|||
err = console_init();
|
||||
if (err != 0) {
|
||||
LOG_ERR("Console init failed: %d", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_INF("Bluetooth initialized");
|
||||
|
@ -1147,4 +1147,5 @@ void main(void)
|
|||
}
|
||||
|
||||
LOG_INF("Exiting");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ static struct bt_iso_big_sync_param big_sync_param = {
|
|||
.sync_timeout = 100, /* in 10 ms units */
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_per_adv_sync_param sync_create_param;
|
||||
struct bt_le_per_adv_sync *sync;
|
||||
|
@ -298,14 +298,14 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(led_gpio.port)) {
|
||||
printk("LED gpio device not ready.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
printk("Configure GPIO pin...");
|
||||
err = gpio_pin_configure_dt(&led_gpio, GPIO_OUTPUT_ACTIVE);
|
||||
if (err) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -316,7 +316,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Scan callbacks register...");
|
||||
|
@ -334,7 +334,7 @@ void main(void)
|
|||
err = bt_le_scan_start(BT_LE_SCAN_CUSTOM, NULL);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -351,7 +351,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_adv, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Found periodic advertising.\n");
|
||||
|
||||
|
@ -359,7 +359,7 @@ void main(void)
|
|||
err = bt_le_scan_stop();
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -375,7 +375,7 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_create(&sync_create_param, &sync);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -388,7 +388,7 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_delete(sync);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_delete(sync);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ big_sync_create:
|
|||
err = bt_iso_big_sync(sync, &big_sync_param, &big);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -437,7 +437,7 @@ big_sync_create:
|
|||
err = bt_iso_big_terminate(big);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -463,7 +463,7 @@ big_sync_create:
|
|||
err = k_sem_take(&sem_big_sync_lost, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("BIG sync lost chan %u.\n", chan);
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ static void bt_ready(int err)
|
|||
printk("Mesh initialized\n");
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
static struct k_work button_work;
|
||||
int err = -1;
|
||||
|
@ -420,7 +420,7 @@ void main(void)
|
|||
err = board_init(&button_work);
|
||||
if (err) {
|
||||
printk("Board init failed (err: %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
k_work_init_delayable(&onoff.work, onoff_timeout);
|
||||
|
@ -430,4 +430,5 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ void board_play(const char *str)
|
|||
k_sem_give(&tune_sem);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -272,7 +272,7 @@ void main(void)
|
|||
err = board_init(&addr);
|
||||
if (err) {
|
||||
printk("Board initialization failed\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Unicast address: 0x%04x\n", addr);
|
||||
|
@ -281,7 +281,7 @@ void main(void)
|
|||
err = bt_enable(bt_ready);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
@ -289,4 +289,5 @@ void main(void)
|
|||
board_play_tune(tune_str);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ static void button_init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
char uuid_hex_str[32 + 1];
|
||||
int err;
|
||||
|
@ -339,7 +339,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -388,4 +388,5 @@ void main(void)
|
|||
|
||||
printk("Added node 0x%04x\n", node_addr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
extern void run_central_sample(bt_gatt_notify_func_t cb);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
run_central_sample(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
extern void run_peripheral_sample(uint8_t *notify_data, size_t notify_data_size, uint16_t seconds);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint8_t notify_data[100] = {};
|
||||
|
||||
|
@ -19,4 +19,5 @@ void main(void)
|
|||
notify_data[99] = 0x55;
|
||||
|
||||
run_peripheral_sample(notify_data, sizeof(notify_data), 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
int observer_start(void);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -19,10 +19,11 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
(void)observer_start();
|
||||
|
||||
printk("Exiting %s thread.\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ static const struct bt_data ad[] = {
|
|||
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 3),
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_ext_adv *adv;
|
||||
int err;
|
||||
|
@ -23,14 +23,14 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create a non-connectable non-scannable advertising set */
|
||||
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN_NAME, NULL, &adv);
|
||||
if (err) {
|
||||
printk("Failed to create advertising set (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set periodic advertising parameters */
|
||||
|
@ -38,14 +38,14 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to set periodic advertising parameters"
|
||||
" (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enable Periodic Advertising */
|
||||
err = bt_le_per_adv_start(adv);
|
||||
if (err) {
|
||||
printk("Failed to enable periodic advertising (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -54,7 +54,7 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to start extended advertising "
|
||||
"(err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -67,7 +67,7 @@ void main(void)
|
|||
err = bt_le_per_adv_set_data(adv, ad, ARRAY_SIZE(ad));
|
||||
if (err) {
|
||||
printk("Failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
}
|
||||
|
@ -79,10 +79,11 @@ void main(void)
|
|||
if (err) {
|
||||
printk("Failed to stop extended advertising "
|
||||
"(err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
k_sleep(K_SECONDS(10));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ static struct bt_le_per_adv_sync_cb sync_callbacks = {
|
|||
.recv = recv_cb
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_per_adv_sync_param sync_create_param;
|
||||
struct bt_le_per_adv_sync *sync;
|
||||
|
@ -167,7 +167,7 @@ void main(void)
|
|||
printk("Checking LED device...");
|
||||
if (!device_is_ready(led.port)) {
|
||||
printk("failed.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -175,7 +175,7 @@ void main(void)
|
|||
err = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||
if (err) {
|
||||
printk("failed.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("done.\n");
|
||||
|
||||
|
@ -186,7 +186,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Scan callbacks register...");
|
||||
|
@ -201,7 +201,7 @@ void main(void)
|
|||
err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, NULL);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -220,7 +220,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_adv, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Found periodic advertising.\n");
|
||||
|
||||
|
@ -233,7 +233,7 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_create(&sync_create_param, &sync);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("success.\n");
|
||||
|
||||
|
@ -246,7 +246,7 @@ void main(void)
|
|||
err = bt_le_per_adv_sync_delete(sync);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_sync_lost, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Periodic sync lost.\n");
|
||||
} while (true);
|
||||
|
|
|
@ -346,7 +346,7 @@ static void hrs_notify(void)
|
|||
bt_hrs_notify(heartrate);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_gatt_attr *vnd_ind_attr;
|
||||
char str[BT_UUID_STR_LEN];
|
||||
|
@ -355,7 +355,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -400,4 +400,5 @@ void main(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -151,14 +151,14 @@ static struct bt_conn_auth_info_cb bt_conn_auth_info = {
|
|||
.pairing_complete = pairing_complete
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -167,4 +167,5 @@ void main(void)
|
|||
while (1) {
|
||||
k_sleep(K_FOREVER);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -396,14 +396,14 @@ static void bas_notify(void)
|
|||
bt_bas_set_battery_level(battery_level);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -419,4 +419,5 @@ void main(void)
|
|||
/* Battery level simulation */
|
||||
bas_notify();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -78,14 +78,14 @@ static int settings_runtime_load(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||
|
@ -99,8 +99,9 @@ void main(void)
|
|||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Advertising successfully started\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -417,14 +417,14 @@ static void bas_notify(void)
|
|||
bt_bas_set_battery_level(battery_level);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -442,4 +442,5 @@ void main(void)
|
|||
/* Battery level simulation */
|
||||
bas_notify();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
extern uint32_t peripheral_gatt_write(uint32_t count);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
(void)peripheral_gatt_write(0U);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -127,14 +127,14 @@ static struct bt_conn_auth_cb auth_cb_display = {
|
|||
.cancel = auth_cancel,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(bt_ready);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_SAMPLE_BT_USE_AUTHENTICATION)) {
|
||||
|
@ -143,4 +143,5 @@ void main(void)
|
|||
}
|
||||
|
||||
hog_button_loop();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -103,14 +103,14 @@ static void hrs_notify(void)
|
|||
bt_hrs_notify(heartrate);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -129,4 +129,5 @@ void main(void)
|
|||
/* Battery level simulation */
|
||||
bas_notify();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -93,14 +93,14 @@ static void bas_notify(void)
|
|||
bt_bas_set_battery_level(battery_level);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_ready();
|
||||
|
@ -119,4 +119,5 @@ void main(void)
|
|||
/* Battery level simulation */
|
||||
bas_notify();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
int init_peripheral(uint8_t iterations);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
(void)init_peripheral(CONFIG_SAMPLE_CONN_ITERATIONS);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -148,14 +148,14 @@ static struct bt_iso_server iso_server = {
|
|||
.accept = iso_accept,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_SETTINGS)) {
|
||||
|
@ -167,14 +167,15 @@ void main(void)
|
|||
err = bt_iso_server_register(&iso_server);
|
||||
if (err) {
|
||||
printk("Unable to register ISO server (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Advertising successfully started\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ static int ots_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -323,7 +323,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -331,15 +331,16 @@ void main(void)
|
|||
err = ots_init();
|
||||
if (err) {
|
||||
printk("Failed to init OTS (err:%d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad),
|
||||
sd, ARRAY_SIZE(sd));
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Advertising successfully started\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ static struct bt_conn_cb conn_callbacks = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_per_adv_sync_transfer_param past_param;
|
||||
int err;
|
||||
|
@ -121,7 +121,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Connection callbacks register...");
|
||||
|
@ -139,13 +139,13 @@ void main(void)
|
|||
&past_param);
|
||||
if (err) {
|
||||
printk("PAST subscribe failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, NULL, 0, NULL, 0);
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -153,7 +153,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_sync, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Periodic sync established.\n");
|
||||
|
||||
|
@ -161,8 +161,9 @@ void main(void)
|
|||
err = k_sem_take(&sem_per_sync_lost, K_FOREVER);
|
||||
if (err) {
|
||||
printk("failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Periodic sync lost.\n");
|
||||
} while (true);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -125,14 +125,14 @@ static struct bt_conn_auth_info_cb auth_cb_info = {
|
|||
.pairing_failed = pairing_failed,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -144,8 +144,9 @@ void main(void)
|
|||
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Advertising successfully started\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ static void scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type,
|
|||
mfg_data[2]++;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_scan_param scan_param = {
|
||||
.type = BT_HCI_LE_SCAN_PASSIVE,
|
||||
|
@ -42,7 +42,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -50,7 +50,7 @@ void main(void)
|
|||
err = bt_le_scan_start(&scan_param, scan_cb);
|
||||
if (err) {
|
||||
printk("Starting scanning failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -61,7 +61,7 @@ void main(void)
|
|||
NULL, 0);
|
||||
if (err) {
|
||||
printk("Advertising failed to start (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
k_sleep(K_MSEC(400));
|
||||
|
@ -69,7 +69,8 @@ void main(void)
|
|||
err = bt_le_adv_stop();
|
||||
if (err) {
|
||||
printk("Advertising failed to stop (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
} while (1);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -178,18 +178,18 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
|
|||
.disconnected = disconnected,
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = button_init(button_callback);
|
||||
if (err) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = led_init();
|
||||
if (err) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize the Bluetooth Subsystem */
|
||||
|
@ -197,4 +197,5 @@ void main(void)
|
|||
if (err) {
|
||||
LOG_ERR("Bluetooth init failed (err %d)", err);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1033,21 +1033,21 @@ static void reset_data(void)
|
|||
configured_source_stream_count = 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
printk("Initializing\n");
|
||||
err = init();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Initialized\n");
|
||||
|
||||
err = bt_bap_unicast_client_register_cb(&unicast_client_cbs);
|
||||
if (err != 0) {
|
||||
printk("Failed to register client callbacks: %d", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -1056,60 +1056,60 @@ void main(void)
|
|||
printk("Waiting for connection\n");
|
||||
err = scan_and_connect();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Connected\n");
|
||||
|
||||
printk("Discovering sinks\n");
|
||||
err = discover_sinks();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Sinks discovered\n");
|
||||
|
||||
printk("Discovering sources\n");
|
||||
err = discover_sources();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Sources discovered\n");
|
||||
|
||||
printk("Configuring streams\n");
|
||||
err = configure_streams();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (configured_stream_count == 0U) {
|
||||
printk("No streams were configured\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Creating unicast group\n");
|
||||
err = create_group();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Unicast group created\n");
|
||||
|
||||
printk("Setting stream QoS\n");
|
||||
err = set_stream_qos();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Stream QoS Set\n");
|
||||
|
||||
printk("Enabling streams\n");
|
||||
err = enable_streams();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Streams enabled\n");
|
||||
|
||||
printk("Starting streams\n");
|
||||
err = start_streams();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Streams started\n");
|
||||
|
||||
|
@ -1120,13 +1120,13 @@ void main(void)
|
|||
err = k_sem_take(&sem_disconnected, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("failed to take sem_disconnected (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Deleting group\n");
|
||||
err = delete_group();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("Group deleted\n");
|
||||
}
|
||||
|
|
|
@ -717,7 +717,7 @@ static int set_available_contexts(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct bt_le_ext_adv *adv;
|
||||
int err;
|
||||
|
@ -725,7 +725,7 @@ void main(void)
|
|||
err = bt_enable(NULL);
|
||||
if (err != 0) {
|
||||
printk("Bluetooth init failed (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Bluetooth initialized\n");
|
||||
|
@ -746,30 +746,30 @@ void main(void)
|
|||
|
||||
err = set_location();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = set_supported_contexts();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = set_available_contexts();
|
||||
if (err != 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create a non-connectable non-scannable advertising set */
|
||||
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN_NAME, NULL, &adv);
|
||||
if (err) {
|
||||
printk("Failed to create advertising set (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||
if (err) {
|
||||
printk("Failed to set advertising data (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -778,7 +778,7 @@ void main(void)
|
|||
err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
|
||||
if (err) {
|
||||
printk("Failed to start advertising set (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Advertising successfully started\n");
|
||||
|
@ -788,7 +788,7 @@ void main(void)
|
|||
err = k_sem_take(&sem_disconnected, K_FOREVER);
|
||||
if (err != 0) {
|
||||
printk("failed to take sem_disconnected (err %d)\n", err);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* reset data */
|
||||
|
@ -796,4 +796,5 @@ void main(void)
|
|||
k_work_cancel_delayable_sync(&audio_send_work, &sync);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -70,19 +70,19 @@ void signal_print_stopped(void)
|
|||
void *rx_block[NUM_MS];
|
||||
size_t rx_size = PCM_BLK_SIZE_MS;
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
uint32_t ms;
|
||||
|
||||
if (!device_is_ready(led0.port)) {
|
||||
printk("LED0 GPIO controller device is not ready\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!device_is_ready(led1.port)) {
|
||||
printk("LED1 GPIO controller device is not ready\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP3943
|
||||
|
@ -90,7 +90,7 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(ledc)) {
|
||||
printk("Device %s is not ready\n", ledc->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* turn all leds on */
|
||||
|
@ -115,19 +115,19 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(mic_dev)) {
|
||||
printk("Device %s is not ready\n", mic_dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = dmic_configure(mic_dev, &cfg);
|
||||
if (ret < 0) {
|
||||
printk("microphone configuration error\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = dmic_trigger(mic_dev, DMIC_TRIGGER_START);
|
||||
if (ret < 0) {
|
||||
printk("microphone start trigger error\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
signal_sampling_started();
|
||||
|
@ -137,7 +137,7 @@ void main(void)
|
|||
ret = dmic_read(mic_dev, 0, &rx_block[ms], &rx_size, 2000);
|
||||
if (ret < 0) {
|
||||
printk("microphone audio read error\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ void main(void)
|
|||
ret = dmic_trigger(mic_dev, DMIC_TRIGGER_STOP);
|
||||
if (ret < 0) {
|
||||
printk("microphone stop trigger error\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* print PCM stream */
|
||||
|
@ -180,4 +180,5 @@ void main(void)
|
|||
#endif
|
||||
|
||||
signal_print_stopped();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ static void lsm6dsl_trigger_handler(const struct device *dev,
|
|||
#define NUM_LEDS 12
|
||||
#define DELAY_TIME K_MSEC(50)
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int cnt = 0;
|
||||
char out_str[64];
|
||||
|
@ -118,7 +118,7 @@ void main(void)
|
|||
#ifdef CONFIG_LP3943
|
||||
if (!device_is_ready(ledc)) {
|
||||
printk("%s: device not ready.\n", ledc->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* turn all leds on */
|
||||
|
@ -136,13 +136,13 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(led0_gpio.port)) {
|
||||
printk("%s: device not ready.\n", led0_gpio.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
gpio_pin_configure_dt(&led0_gpio, GPIO_OUTPUT_ACTIVE);
|
||||
|
||||
if (!device_is_ready(led1_gpio.port)) {
|
||||
printk("%s: device not ready.\n", led1_gpio.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
gpio_pin_configure_dt(&led1_gpio, GPIO_OUTPUT_INACTIVE);
|
||||
|
||||
|
@ -159,7 +159,7 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(baro_dev)) {
|
||||
printk("%s: device not ready.\n", baro_dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -168,7 +168,7 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(hum_dev)) {
|
||||
printk("%s: device not ready.\n", hum_dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -177,7 +177,7 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(accel_dev)) {
|
||||
printk("%s: device not ready.\n", accel_dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_LSM6DSL_ACCEL_ODR) && (CONFIG_LSM6DSL_ACCEL_ODR == 0)
|
||||
|
@ -190,7 +190,7 @@ void main(void)
|
|||
if (sensor_attr_set(accel_dev, SENSOR_CHAN_ACCEL_XYZ,
|
||||
SENSOR_ATTR_SAMPLING_FREQUENCY, &a_odr_attr) < 0) {
|
||||
printk("Cannot set sampling frequency for accelerometer.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -203,7 +203,7 @@ void main(void)
|
|||
if (sensor_attr_set(accel_dev, SENSOR_CHAN_ACCEL_XYZ,
|
||||
SENSOR_ATTR_FULL_SCALE, &a_fs_attr) < 0) {
|
||||
printk("Cannot set fs for accelerometer.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -217,7 +217,7 @@ void main(void)
|
|||
if (sensor_attr_set(accel_dev, SENSOR_CHAN_GYRO_XYZ,
|
||||
SENSOR_ATTR_SAMPLING_FREQUENCY, &g_odr_attr) < 0) {
|
||||
printk("Cannot set sampling frequency for gyro.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -230,7 +230,7 @@ void main(void)
|
|||
if (sensor_attr_set(accel_dev, SENSOR_CHAN_GYRO_XYZ,
|
||||
SENSOR_ATTR_FULL_SCALE, &g_fs_attr) < 0) {
|
||||
printk("Cannot set fs for gyroscope.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -241,7 +241,7 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(tof_dev)) {
|
||||
printk("%s: device not ready.\n", tof_dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -253,7 +253,7 @@ void main(void)
|
|||
if (sensor_trigger_set(accel_dev, &trig,
|
||||
lsm6dsl_trigger_handler) != 0) {
|
||||
printk("Could not set sensor type and channel\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ K_THREAD_DEFINE(thread_a, STACKSIZE, threadA, NULL, NULL, NULL,
|
|||
PRIORITY, 0, 0);
|
||||
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
/* necessary configuration before go to normal */
|
||||
int32_t i = 0;
|
||||
|
@ -56,4 +56,5 @@ void main(void)
|
|||
__func__, i++);
|
||||
k_msleep(SLEEPTIME);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ static const struct mb_image animation[] = {
|
|||
{ 1, 1, 1, 1, 1 }),
|
||||
};
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct mb_display *disp = mb_display_get();
|
||||
int x, y;
|
||||
|
@ -104,4 +104,5 @@ void main(void)
|
|||
/* Show some scrolling text ("Hello Zephyr!") */
|
||||
mb_display_print(disp, MB_DISPLAY_MODE_DEFAULT | MB_DISPLAY_FLAG_LOOP,
|
||||
500, "Hello Zephyr!");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -95,17 +95,17 @@ static void line_follow(void)
|
|||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
if (!device_is_ready(left_gpio.port) ||
|
||||
!device_is_ready(right_gpio.port)) {
|
||||
printk("Left/Right GPIO controllers not ready.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!device_is_ready(motorctl.bus)) {
|
||||
printk("Motor controller I2C bus not ready.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Setup gpio to read data from digital line sensors of the robot */
|
||||
|
@ -123,4 +123,5 @@ void main(void)
|
|||
while (1) {
|
||||
line_follow();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -513,7 +513,7 @@ static void configure_buttons(void)
|
|||
gpio_add_callback(sw0_gpio.port, &button_cb_data);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
struct mb_display *disp = mb_display_get();
|
||||
|
||||
|
@ -523,7 +523,7 @@ void main(void)
|
|||
|
||||
if (!device_is_ready(pwm.dev)) {
|
||||
printk("%s: device not ready.\n", pwm.dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ble_init();
|
||||
|
@ -551,4 +551,5 @@ void main(void)
|
|||
mb_display_image(disp, MB_DISPLAY_MODE_SINGLE,
|
||||
SYS_FOREVER_MS, &img, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -81,19 +81,19 @@ static void button_pressed(const struct device *dev, struct gpio_callback *cb,
|
|||
k_work_submit(&beep_work);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
static struct gpio_callback button_cb_data;
|
||||
|
||||
if (!device_is_ready(pwm.dev)) {
|
||||
printk("%s: device not ready.\n", pwm.dev->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* since sw0_gpio.port == sw1_gpio.port, we only need to check ready once */
|
||||
if (!device_is_ready(sw0_gpio.port)) {
|
||||
printk("%s: device not ready.\n", sw0_gpio.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
period = pwm.period;
|
||||
|
@ -112,4 +112,5 @@ void main(void)
|
|||
k_work_submit(&beep_work);
|
||||
|
||||
gpio_add_callback(sw0_gpio.port, &button_cb_data);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ static const struct gpio_dt_spec wakeup_button = GPIO_DT_SPEC_GET(DT_ALIAS(wakeu
|
|||
#endif
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
switch (esp_sleep_get_wakeup_cause()) {
|
||||
#ifdef CONFIG_EXAMPLE_EXT1_WAKEUP
|
||||
|
@ -87,7 +87,7 @@ void main(void)
|
|||
#ifdef CONFIG_EXAMPLE_GPIO_WAKEUP
|
||||
if (!device_is_ready(wakeup_button.port)) {
|
||||
printk("Error: wakeup button device %s is not ready\n", wakeup_button.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret = gpio_pin_configure_dt(&wakeup_button, GPIO_INPUT);
|
||||
|
@ -95,7 +95,7 @@ void main(void)
|
|||
if (ret != 0) {
|
||||
printk("Error %d: failed to configure %s pin %d\n",
|
||||
ret, wakeup_button.port->name, wakeup_button.pin);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
esp_deep_sleep_enable_gpio_wakeup(BIT(wakeup_button.pin), ESP_GPIO_WAKEUP_GPIO_HIGH);
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
/* NET_CONFIG_SETTINGS will init DHCP
|
||||
* NET_SHELL is enabled to test ping, DNS etc
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(flash_encryption, CONFIG_LOG_DEFAULT_LEVEL);
|
|||
#error Flash encryption feature is only available for ESP32 SOC yet.
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint8_t buffer[32];
|
||||
const struct device *flash_device;
|
||||
|
@ -29,7 +29,7 @@ void main(void)
|
|||
flash_device = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
|
||||
if (!device_is_ready(flash_device)) {
|
||||
printk("%s: device not ready.\n", flash_device->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 32; k++) {
|
||||
|
@ -52,4 +52,5 @@ void main(void)
|
|||
memset(buffer, 0, sizeof(buffer));
|
||||
flash_read(flash_device, address, &buffer, sizeof(buffer));
|
||||
LOG_HEXDUMP_INF(buffer, sizeof(buffer), "FLASH DECRYPTED DATA");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
static const struct gpio_dt_spec button =
|
||||
GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0});
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
if (!device_is_ready(button.port)) {
|
||||
printk("Error: button device %s is not ready\n", button.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int wakeup_level = (button.dt_flags & GPIO_ACTIVE_LOW) ? 0 : 1;
|
||||
|
@ -91,4 +91,5 @@ void main(void)
|
|||
wakeup_reason, t_after_ms, (t_after_ms - t_before_ms));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ ret:
|
|||
return err;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int err = test_heap_caps(10001);
|
||||
|
||||
|
@ -83,4 +83,5 @@ void main(void)
|
|||
} else {
|
||||
printk("Internal mem test pass\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("Welcome to Google Kukui\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
extern void reloc(void);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("%s location: %p\n", __func__, main);
|
||||
printk("Calling relocated code\n");
|
||||
reloc();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ static void init(void)
|
|||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
|
@ -112,4 +112,5 @@ void main(void)
|
|||
i2s_write(host_i2s_tx_dev, tx_mem_block, size);
|
||||
k_mem_slab_free(&i2s_rx_mem_slab, &rx_mem_block);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ LOG_MODULE_DECLARE(mec15_brd_test);
|
|||
|
||||
#define MAX_CYCLES 5ul
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
test_pwr_mgmt_singlethread(false, MAX_CYCLES);
|
||||
|
||||
|
@ -20,4 +20,5 @@ void main(void)
|
|||
test_pwr_mgmt_multithread(false, MAX_CYCLES);
|
||||
|
||||
test_pwr_mgmt_multithread(true, MAX_CYCLES);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, { 0 });
|
||||
static const struct device *const snvs_rtc_dev = DEVICE_DT_GET(SNVS_RTC_NODE);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("\n%s system off demo\n", CONFIG_BOARD);
|
||||
|
||||
if (!device_is_ready(button.port)) {
|
||||
printk("Error: button device %s is not ready\n", button.port->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Configure to generate PORT event (wakeup) on button press. */
|
||||
|
@ -47,14 +47,14 @@ void main(void)
|
|||
if (ret != 0) {
|
||||
printk("Error %d: failed to configure %s pin %d\n", ret, button.port->name,
|
||||
button.pin);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_LEVEL_LOW);
|
||||
if (ret != 0) {
|
||||
printk("Error %d: failed to configure interrupt on %s pin %d\n", ret,
|
||||
button.port->name, button.pin);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printk("Busy-wait %u s\n", BUSY_WAIT_S);
|
||||
|
@ -78,7 +78,7 @@ void main(void)
|
|||
ret = counter_set_channel_alarm(snvs_rtc_dev, SNVS_LP_RTC_ALARM_ID, &alarm_cfg);
|
||||
if (ret != 0) {
|
||||
printk("Could not rtc alarm.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("RTC Alarm set for %llu seconds to wake from soft-off.\n",
|
||||
counter_ticks_to_us(snvs_rtc_dev, alarm_cfg.ticks) / (1000ULL * 1000ULL));
|
||||
|
@ -96,4 +96,5 @@ void main(void)
|
|||
while (true) {
|
||||
/* spin to avoid fall-off behavior */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
static const struct device *const rtc_dev = DEVICE_DT_GET(RTC_NODE);
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -48,7 +48,7 @@ void main(void)
|
|||
ret = counter_set_channel_alarm(rtc_dev, RTC_CHANNEL_ID, &alarm_cfg);
|
||||
if (ret != 0) {
|
||||
printk("Could not rtc alarm.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
printk("RTC Alarm set for %llu seconds to wake from soft-off.\n",
|
||||
counter_ticks_to_us(rtc_dev, alarm_cfg.ticks) / (1000ULL * 1000ULL));
|
||||
|
@ -65,4 +65,5 @@ void main(void)
|
|||
while (true) {
|
||||
/* spin to avoid fall-off behavior */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -52,13 +52,13 @@ static const char *now_str(void)
|
|||
return buf;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
int rc = battery_measure_enable(true);
|
||||
|
||||
if (rc != 0) {
|
||||
printk("Failed initialize battery measurement: %d\n", rc);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -79,4 +79,5 @@ void main(void)
|
|||
k_busy_wait(5 * USEC_PER_SEC);
|
||||
}
|
||||
printk("Disable: %d\n", battery_measure_enable(false));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ static void sync_work_handler(struct k_work *work)
|
|||
K_SECONDS(UPDATE_INTERVAL_S));
|
||||
}
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
uint32_t top;
|
||||
int rc;
|
||||
|
@ -202,7 +202,7 @@ void main(void)
|
|||
/* Grab the clock driver */
|
||||
if (!device_is_ready(clock0)) {
|
||||
printk("%s: device not ready.\n", clock0->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
show_clocks("Power-up clocks");
|
||||
|
@ -215,7 +215,7 @@ void main(void)
|
|||
/* Grab the timer. */
|
||||
if (!device_is_ready(timer0)) {
|
||||
printk("%s: device not ready.\n", timer0->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Apparently there's no API to configure a frequency at
|
||||
|
@ -225,14 +225,14 @@ void main(void)
|
|||
if (sync_config.ref_Hz == 0) {
|
||||
printk("Timer %s has no fixed frequency\n",
|
||||
timer0->name);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
top = counter_get_top_value(timer0);
|
||||
if (top != UINT32_MAX) {
|
||||
printk("Timer %s wraps at %u (0x%08x) not at 32 bits\n",
|
||||
timer0->name, top, top);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = counter_start(timer0);
|
||||
|
@ -253,4 +253,5 @@ void main(void)
|
|||
rc = k_work_schedule(&sync_work, K_NO_WAIT);
|
||||
|
||||
printk("Started sync: %d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
#include <zephyr/sys/printk.h>
|
||||
|
||||
void main(void)
|
||||
int main(void)
|
||||
{
|
||||
printk("Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue