Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 14 additions & 19 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Use the base image for ESP-IDF development
FROM espressif/idf:v6.0-dev

# Install necessary packages
USER root

# Install sudo and other essential packages
RUN apt-get update && apt-get install -y \
sudo \
curl \
Expand All @@ -19,41 +16,39 @@ RUN apt-get update && apt-get install -y \
locales \
doxygen \
graphviz \
texlive-full \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-plain-generic \
latexmk \
clang \
clangd \
clang-format \
clang-tidy \
clang-tools \
cppcheck \
flawfinder \
python3-pip \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*

# Set nano as the default Git editor
RUN git config --global core.editor "nano"

# Set the working directory
WORKDIR /root

# Install arduino-cli as the root user
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh

# Install git completion
RUN curl -o /etc/bash_completion.d/git-completion.bash \
https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

# Copy and set up terminal scripts
COPY .devcontainer/setup-terminal.sh /root/setup-terminal.sh
RUN chmod +x /root/setup-terminal.sh

# Update .bashrc for git completion and custom scripts
RUN echo "source /etc/bash_completion.d/git-completion.bash" >> /root/.bashrc \
&& echo "source /root/setup-terminal.sh" >> /root/.bashrc \
&& echo "source /opt/esp/idf/export.sh >/dev/null 2>&1" >> /root/.bashrc

# Set locale to a UTF-8 compatible setting
RUN apt-get update && apt-get install -y locales && \
locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

# Ensure the final user is root
USER root
USER root
54 changes: 33 additions & 21 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,52 @@
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": { "USERNAME": "root", "USER_UID": "1000", "USER_GID": "1000" }
"args": {
"USERNAME": "root",
"USER_UID": "1000",
"USER_GID": "1000"
}
},

"runArgs": [
"--device=/dev/ttyACM0",
"--privileged"

],

"settings": { "terminal.integrated.defaultProfile.linux": "bash" },

"extensions": [
"vsciot-vscode.vscode-arduino",
"ms-vscode.cpptools",
"eamodio.gitlens",
"cschlosser.doxdocgen",
"samubarb.vscode-doxyfile",
"openai.tu-extension-codex",
"github.vscode-pull-request-github",
"llvm-vs-code-extensions.vscode-clangd",
"jbenden.c-cpp-flylint"
],

"remoteUser": "root",

"mounts": [
"source=${localEnv:HOME}/.ssh,target=/tmp/host-ssh,type=bind,consistency=cached,readonly",
"source=${localEnv:HOME}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached,readonly"
],

"postCreateCommand": "/bin/bash -lc 'echo \"source /opt/esp/idf/export.sh\" >> ~/.bashrc && mkdir -p /root/.ssh && cp -a /tmp/host-ssh/. /root/.ssh/ 2>/dev/null || true && chown -R root:root /root/.ssh && chmod 700 /root/.ssh && for f in /root/.ssh/config /root/.ssh/known_hosts /root/.ssh/id_rsa /root/.ssh/raspberrypi /root/.ssh/id_ed25519; do [ -f \"$f\" ] && chmod 600 \"$f\"; done && for f in /root/.ssh/id_rsa.pub /root/.ssh/raspberrypi.pub /root/.ssh/id_ed25519.pub; do [ -f \"$f\" ] && chmod 644 \"$f\"; done && echo \"Dev container ready for ESP-IDF development!\"'",

"remoteEnv": {
"IDF_PATH": "/opt/esp/idf",
"PATH": "/opt/esp/idf/tools:${env:PATH}"
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"C_Cpp.intelliSenseEngine": "disabled",
"editor.formatOnSave": true,
"clangd.path": "/usr/bin/clangd",
"[c]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
},
"extensions": [
"vsciot-vscode.vscode-arduino",
"ms-vscode.cpptools",
"eamodio.gitlens",
"cschlosser.doxdocgen",
"samubarb.vscode-doxyfile",
"openai.tu-extension-codex",
"github.vscode-pull-request-github",
"llvm-vs-code-extensions.vscode-clangd",
"xaver.clang-format",
"jbenden.c-cpp-flylint"
]
}
}
}
2 changes: 1 addition & 1 deletion solaris-v1/components/general/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ idf_component_register(
"gpio_int.c"
INCLUDE_DIRS "."
REQUIRES esp_driver_spi esp_driver_gpio
PRIV_REQUIRES icm_driver pressure_sensor_driver
PRIV_REQUIRES icm_driver pressureSensorDriver
)
14 changes: 14 additions & 0 deletions solaris-v1/components/general/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ extern "C" {
/** @brief GPIO pin for SPI clock. */
#define PIN_NUM_CLK 48

/* ----------------------------------------------------------------
* SPI operation type
* ---------------------------------------------------------------- */

/**
* @brief SPI read operation bit.
*/
#define K_READ_OP 0x80U

/**
* @brief SPI write operation bit.
*/
#define K_WRITE_OP 0x00U

/**
* @brief Legacy SPI device context.
*
Expand Down
21 changes: 11 additions & 10 deletions solaris-v1/components/icm_driver/icm20948.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "icm20948.h"
#include "macros.h"
#include "spp/core/returntypes.h"
#include "spp/hal/spi/spi.h"
#include "spp/osal/task.h"
Expand Down Expand Up @@ -97,7 +98,7 @@ static const spp_uint8_t s_dmp3Image[] = {
*/
static retval_t ICM20948_writeReg(void *p_spi, spp_uint8_t reg, spp_uint8_t value)
{
spp_uint8_t txBuffer[2] = {K_ICM20948_WRITE_OP | reg, value};
spp_uint8_t txBuffer[2] = {K_WRITE_OP | reg, value};
return SPP_HAL_SPI_Transmit(p_spi, txBuffer, 2U);
}

Expand All @@ -112,7 +113,7 @@ static retval_t ICM20948_writeReg(void *p_spi, spp_uint8_t reg, spp_uint8_t valu
*/
static retval_t ICM20948_readReg(void *p_spi, spp_uint8_t reg, spp_uint8_t *p_value)
{
spp_uint8_t txRxBuffer[2] = {K_ICM20948_READ_OP | reg, K_ICM20948_EMPTY_MESSAGE};
spp_uint8_t txRxBuffer[2] = {K_READ_OP | reg, K_WRITE_OP};
retval_t ret = SPP_HAL_SPI_Transmit(p_spi, txRxBuffer, 2U);

if (p_value != NULL)
Expand Down Expand Up @@ -1427,8 +1428,8 @@ void ICM20948_checkFifoData(void *p_data)
return;
}

txRxData[0] = K_ICM20948_READ_OP | K_ICM20948_REG_INT_STATUS;
txRxData[1] = K_ICM20948_EMPTY_MESSAGE;
txRxData[0] = K_READ_OP | K_ICM20948_REG_INT_STATUS;
txRxData[1] = K_WRITE_OP;

ret = SPP_HAL_SPI_Transmit(p_spi, txRxData, 2U);
if (ret != SPP_OK)
Expand All @@ -1439,8 +1440,8 @@ void ICM20948_checkFifoData(void *p_data)
{
spp_uint8_t intStatus = txRxData[1];

txRxData[0] = K_ICM20948_READ_OP | K_ICM20948_REG_DMP_INT_STATUS;
txRxData[1] = K_ICM20948_EMPTY_MESSAGE;
txRxData[0] = K_READ_OP | K_ICM20948_REG_DMP_INT_STATUS;
txRxData[1] = K_WRITE_OP;

ret = SPP_HAL_SPI_Transmit(p_spi, txRxData, 2U);
if (ret != SPP_OK)
Expand All @@ -1450,9 +1451,9 @@ void ICM20948_checkFifoData(void *p_data)

if ((intStatus & 0x02U) != 0U)
{
txRxData[0] = K_ICM20948_READ_OP | K_ICM20948_REG_FIFO_COUNTH;
txRxData[1] = K_ICM20948_EMPTY_MESSAGE;
txRxData[2] = K_ICM20948_EMPTY_MESSAGE;
txRxData[0] = K_READ_OP | K_ICM20948_REG_FIFO_COUNTH;
txRxData[1] = K_WRITE_OP;
txRxData[2] = K_WRITE_OP;

ret = SPP_HAL_SPI_Transmit(p_spi, txRxData, 3U);
if (ret != SPP_OK)
Expand All @@ -1476,7 +1477,7 @@ void ICM20948_checkFifoData(void *p_data)
{
spp_uint8_t fifoBuffer[K_ICM20948_DMP_PACKET_SIZE_BYTES + 1U] = {0U};

fifoBuffer[0] = K_ICM20948_READ_OP | K_ICM20948_REG_FIFO_R_W;
fifoBuffer[0] = K_READ_OP | K_ICM20948_REG_FIFO_R_W;
ret = SPP_HAL_SPI_Transmit(p_spi, fifoBuffer,
K_ICM20948_DMP_PACKET_SIZE_BYTES + 1U);
if (ret != SPP_OK)
Expand Down
37 changes: 0 additions & 37 deletions solaris-v1/components/icm_driver/include/icm20948.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,49 +47,12 @@
* Hardware pins
* ---------------------------------------------------------------- */

/**
* @brief SPI host used by the ICM20948 device.
*/
#define K_ICM20948_SPI_HOST_USED SPI2_HOST

/**
* @brief Chip-select GPIO number.
*/
#define K_ICM20948_PIN_NUM_CS 21U

/**
* @brief CIPO/MISO GPIO number.
*/
#define K_ICM20948_PIN_NUM_CIPO 47U

/**
* @brief COPI/MOSI GPIO number.
*/
#define K_ICM20948_PIN_NUM_COPI 38U

/**
* @brief SPI clock GPIO number.
*/
#define K_ICM20948_PIN_NUM_CLK 48U

/* ----------------------------------------------------------------
* SPI operation type
* ---------------------------------------------------------------- */

/**
* @brief SPI read operation bit.
*/
#define K_ICM20948_READ_OP 0x80U

/**
* @brief SPI write operation bit.
*/
#define K_ICM20948_WRITE_OP 0x00U

/**
* @brief Dummy byte used during SPI read operations.
*/
#define K_ICM20948_EMPTY_MESSAGE 0x00U

/* ----------------------------------------------------------------
* Register banks
Expand Down
Loading
Loading