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
21 changes: 11 additions & 10 deletions .github/workflows/checkpatch.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CI
name: checkpatch review

# Controls when the workflow will run
on:
Expand All @@ -15,15 +15,16 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
my_review:
name: checkpatch review
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: checkpatch.pl PR review
uses: webispy/checkpatch-action@v8
- name: 'Calculate PR commits + 1'
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Run checkpatch review
uses: webispy/checkpatch-action@v9

5 changes: 2 additions & 3 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

config ARDUINO_API
bool "ARDUINO_API"
imply CPLUSPLUS
# imply CPLUSPLUS
imply GPIO
imply CPLUSPLUS
imply I2C
imply NEWLIB_LIBC_FLOAT_PRINTF
imply CBPRINTF_FP_SUPPORT
imply RING_BUFFER
select UART_INTERRUPT_DRIVEN
# select UART_INTERRUPT_DRIVEN
default n

if ARDUINO_API
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/zephyrSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user

DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_SERIAL_N)
#endif // PROP_LEN(serials) > 1
#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial))
#elif DT_NODE_HAS_STATUS(DT_NODELABEL(arduino_serial), okay)
/* If serials node is not defined, tries to use arduino_serial */
arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_NODELABEL(arduino_serial)));
#else
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/zephyrSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), serials, DECLARE_EXTERN_SERIAL_N)
#undef EXTERN_SERIAL_N
#undef SERIAL_DEFINED_0
#endif
#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_serial))
#elif DT_NODE_HAS_STATUS(DT_NODELABEL(arduino_serial), okay)
extern arduino::ZephyrSerial Serial;
#else
extern arduino::ZephyrSerialStub Serial;
Expand Down
19 changes: 19 additions & 0 deletions samples/hello_arduino/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"device": "native_posix",
"cwd": "${workspaceFolder}",
"program": "/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/samples/hello_arduino/build/zephyr/zephyr.exe",
"request": "launch",
"type": "cppdbg",
"runToEntryPoint": "main",
"gdbPath": "/usr/bin/gdb",
"preLaunchTask": "West Build"
},
]
}
11 changes: 11 additions & 0 deletions samples/hello_arduino/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
// Hush CMake
"cmake.configureOnOpen": false,

// IntelliSense
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",

// File Associations
"files.associations": {
}
}
36 changes: 36 additions & 0 deletions samples/hello_arduino/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "West Build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"linux": {
"command": "/home/dhruva/zephyrproject/.venv/bin/west"
},
"args": [
"build",
"-p",
"always",
"-b",
"native_posix"
],
"problemMatcher": [
"$gcc"
]

}
],
"inputs": [
{
"id": "board",
"type": "promptString",
"default": "native_posix",
"description": "See https://docs.zephyrproject.org/latest/boards/index.html"
},
]

}
5 changes: 4 additions & 1 deletion samples/hello_arduino/prj.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
CONFIG_CPLUSPLUS=y
CONFIG_ARDUINO_API=y
CONFIG_ARDUINO_API=y
# CONFIG_ZTEST=y
# CONFIG_ZTEST_NEW_API=y

7 changes: 7 additions & 0 deletions variants/native_posix/native_posix.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/ {
zephyr,user {
digital-pin-gpios = <&gpio0 0 0>;
serial = <&uart0>;
i2cs = <&i2c0>;
};
};
13 changes: 13 additions & 0 deletions variants/native_posix/native_posix_pinmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2022 Dhruva Gole
*
* SPDX-License-Identifier: Apache-2.0
*/

/* All the pins that are 100 + x are gpio1 pins and < 100 are in gpio0 */
#pragma once
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/device.h>

3 changes: 3 additions & 0 deletions variants/variants.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#ifdef CONFIG_BOARD_CC3220SF_LAUNCHXL
#include "cc3220sf_launchxl_pinmap.h"
#endif // CONFIG_BOARD_CC3220SF_LAUNCHXL
#ifdef CONFIG_BOARD_NATIVE_POSIX
#include "native_posix_pinmap.h"
#endif // CONFIG_BOARD_NATIVE_POSIX

#define DIGITAL_PIN_EXISTS(n, p, i, dev, num) \
(((dev == DT_REG_ADDR(DT_PHANDLE_BY_IDX(n, p, i))) && \
Expand Down