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

feat(front-leds): diamond: use update_channels to set brightness #161

Draft
wants to merge 19 commits into
base: fouge/zephyr-4.0.0
Choose a base branch
from
Draft
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
chore(picolibc): use picolibc by default instead of newlib
redefine M_PI
BUILD_ASSERT must be used instead of static_assert

Signed-off-by: Cyril Fougeray <cyril.fougeray@toolsforhumanity.com>
fouge committed Jan 17, 2025
commit ce7fe452dad99770402aa622b7afdefa46967c72
8 changes: 8 additions & 0 deletions lib/include/utils.h
Original file line number Diff line number Diff line change
@@ -52,4 +52,12 @@
} while (0)
#endif

// _ANSI_SOURCE is used with newlib to make sure newlib doesn't provide
// primitives conflicting with Zephyr's POSIX definitions which remove
// definition of M_PI, so let's redefine it
#if defined(_ANSI_SOURCE)
// taken from math.h
#define M_PI 3.14159265358979323846f
#endif

#define STATIC_OR_EXTERN static
4 changes: 2 additions & 2 deletions main_board/prj.conf
Original file line number Diff line number Diff line change
@@ -24,8 +24,8 @@ CONFIG_RING_BUFFER=y
CONFIG_UART_ASYNC_API=y

# Floating Point Options
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=y
CONFIG_PICOLIBC=y
CONFIG_PICOLIBC_IO_FLOAT=y
CONFIG_FPU=y
CONFIG_FPU_SHARING=y

9 changes: 1 addition & 8 deletions main_board/src/optics/mirror/mirror.c
Original file line number Diff line number Diff line change
@@ -7,19 +7,12 @@
#include <app_config.h>
#include <math.h>
#include <stdlib.h>
#include <utils.h>
#include <zephyr/device.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/byteorder.h>

// _ANSI_SOURCE is used with newlib to make sure newlib doesn't provide
// primitives conflicting with Zephyr's POSIX definitions which remove
// definition of M_PI, so let's redefine it
#if defined(CONFIG_NEWLIB_LIBC) && defined(_ANSI_SOURCE)
// taken from math.h
#define M_PI 3.14159265358979323846f
#endif

LOG_MODULE_REGISTER(mirror, CONFIG_MIRROR_LOG_LEVEL);

K_THREAD_STACK_DEFINE(stack_area_mirror_work_queue, 2048);
2 changes: 1 addition & 1 deletion main_board/src/power/battery/battery_amber.c
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ static orb_mcu_main_BatteryIsCharging is_charging;
#define BATTERY_MESSAGES_REMOVED_TIMEOUT_MS (BATTERY_INFO_SEND_PERIOD_MS * 3)
#define BATTERY_MESSAGES_FORCE_REBOOT_TIMEOUT_MS \
(BATTERY_INFO_SEND_PERIOD_MS * 10)
static_assert(
BUILD_ASSERT(
BATTERY_MESSAGES_FORCE_REBOOT_TIMEOUT_MS > BATTERY_INFO_SEND_PERIOD_MS * 3,
"Coarse timing resolution to check if battery is still sending messages");

2 changes: 1 addition & 1 deletion main_board/src/power/battery/battery_ruby.c
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ static orb_mcu_main_BatteryIsCharging is_charging;
#define BATTERY_MESSAGES_REMOVED_TIMEOUT_MS (BATTERY_INFO_SEND_PERIOD_MS * 3)
#define BATTERY_MESSAGES_FORCE_REBOOT_TIMEOUT_MS \
(BATTERY_INFO_SEND_PERIOD_MS * 10)
static_assert(
BUILD_ASSERT(
BATTERY_MESSAGES_FORCE_REBOOT_TIMEOUT_MS > BATTERY_INFO_SEND_PERIOD_MS * 3,
"Coarse timing resolution to check if battery is still sending messages");

5 changes: 2 additions & 3 deletions main_board/src/runner/runner.c
Original file line number Diff line number Diff line change
@@ -1445,9 +1445,8 @@ static const hm_callback handle_message_callbacks[] = {
#endif
};

static_assert(
ARRAY_SIZE(handle_message_callbacks) <= 48,
"It seems like the `handle_message_callbacks` array is too large");
BUILD_ASSERT((ARRAY_SIZE(handle_message_callbacks) <= 48),
"It seems like the `handle_message_callbacks` array is too large");

_Noreturn static void
runner_process_jobs_thread()