Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5ffd974
DRAFT respberry pi support
pschatzmann Sep 29, 2025
53cbf74
readme
pschatzmann Sep 29, 2025
18f94d9
standardize defines
pschatzmann Sep 29, 2025
ad72a13
doxygen
pschatzmann Sep 29, 2025
d7f5aed
README
pschatzmann Sep 29, 2025
5288c83
Raspberry PI support
pschatzmann Sep 29, 2025
67d7dfe
RPI Errors
pschatzmann Sep 29, 2025
1723fe6
RPI corrections
pschatzmann Sep 29, 2025
6dbe9f5
RPI corrections
pschatzmann Sep 29, 2025
fb994f5
RPI corrections
pschatzmann Sep 29, 2025
d0f5f95
RPI corrections
pschatzmann Sep 29, 2025
c60f3fe
RPI corrections
pschatzmann Sep 29, 2025
e355d49
RPI: fix blink example
pschatzmann Sep 29, 2025
efc2ccc
RPI: fix blink.ino
pschatzmann Sep 29, 2025
ec67de3
RPI: blink.ino
pschatzmann Sep 29, 2025
36da1d0
RPI: fix SPI
pschatzmann Sep 29, 2025
2c54c07
RPI: fix SPI
pschatzmann Sep 29, 2025
956ba4d
RPI - compile errors
pschatzmann Sep 29, 2025
a9b4bdb
RPI: I2C compile errors
pschatzmann Sep 29, 2025
d63406b
RPI: I2C compile errors
pschatzmann Sep 29, 2025
f169eaa
RPI: i2c compile errors
pschatzmann Sep 29, 2025
38e0a79
Rasperry PI
pschatzmann Sep 29, 2025
5265fb4
blink: add println
pschatzmann Sep 29, 2025
cfd08e4
RPI: Cleanup
pschatzmann Sep 29, 2025
b5cbcaa
WiFiUDPStream: cleanup
pschatzmann Sep 29, 2025
3899ac8
USE_HTTPS
pschatzmann Sep 29, 2025
afbb3b0
upgrade WolfSSL
pschatzmann Sep 29, 2025
e498fbe
Compile errors wifi-secure
pschatzmann Sep 29, 2025
d5113da
examples
pschatzmann Sep 29, 2025
73c3395
README
pschatzmann Sep 29, 2025
fb9e900
RPI
pschatzmann Sep 29, 2025
1fa3963
cleanup HardwareSetup
pschatzmann Sep 29, 2025
96ade60
Resolve IP addresses
pschatzmann Sep 29, 2025
c4d695f
SSL
pschatzmann Sep 30, 2025
1cafaf5
Unit tests
pschatzmann Sep 30, 2025
6786160
gitignroe
pschatzmann Sep 30, 2025
ef249c9
ArduinoAPI v1.5.2
pschatzmann Sep 30, 2025
571056d
wifi-secure.ino
pschatzmann Sep 30, 2025
bde8fab
https
pschatzmann Sep 30, 2025
74ed13f
README
pschatzmann Sep 30, 2025
950490b
build.sh success message
pschatzmann Sep 30, 2025
7e9160f
RPI corrections
pschatzmann Sep 30, 2025
525b877
fix misspelled raspberry_pi
pschatzmann Sep 30, 2025
7f75608
RPI: I2C compile errors
pschatzmann Sep 30, 2025
f465d36
RPI: add back uint8_t spi_bits = 8; // Default to 8 bits pe…
pschatzmann Sep 30, 2025
a90f449
RPI: link_libraries(gpiod)
pschatzmann Sep 30, 2025
30ddd5a
gpiod
pschatzmann Sep 30, 2025
b146201
RPI: add HardwareSetupRPI
pschatzmann Sep 30, 2025
866f710
Fix RPI
pschatzmann Sep 30, 2025
76968a0
rename examples to rasperry-pi
pschatzmann Sep 30, 2025
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
17 changes: 17 additions & 0 deletions .github/workflows/c-cpp-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: C/C++ CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: build.sh
run: ./build.sh
54 changes: 54 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Unit Tests

on:
pull_request:
# Only run workflow if a file in these paths is modified
paths:
- ".github/workflows/unit-tests.yml"
- "ArduinoCore-API/test/**"
- "ArduinoCore-API/api/**"

push:
paths:
- ".github/workflows/unit-tests.yml"
- "ArduinoCore-API/test/**"
- "ArduinoCore-API/api/**"

jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest

env:
COVERAGE_DATA_PATH: extras/coverage-data/coverage.info

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Relax some warings
# run: echo 'add_compile_options(-Wno-unused-function)' >> ArduinoCore-API/test/CMakeLists.txt
# run: echo 'add_compile_options(-Wno-error=all)' >> ArduinoCore-API/test/CMakeLists.txt
# run: echo 'add_compile_options(-Wno-error=unused-function)' >> ArduinoCore-API/test/CMakeLists.txt
run: sed -i 's/-Werror//g' ArduinoCore-API/test/CMakeLists.txt


# See: https://github.com/arduino/cpp-test-action/blob/main/README.md
- uses: arduino/cpp-test-action@main
with:
source-path: ArduinoCore-API/test
build-path: ArduinoCore-API/test/build
runtime-path: ArduinoCore-API/test/build/bin/test-ArduinoCore-API
coverage-exclude-paths: |
- '*/test/*'
- '/usr/*'
coverage-data-path: ${{ env.COVERAGE_DATA_PATH }}

# Temporary excluded to prevent token requirement
# See: https://github.com/codecov/codecov-action/blob/master/README.md
#- name: Code coverage
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ${{ env.COVERAGE_DATA_PATH }}
# fail_ci_if_error: true
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build
.*
build/
.vscode

11 changes: 6 additions & 5 deletions ArduinoCore-API/api/ArduinoAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
Expand All @@ -20,8 +20,8 @@
#ifndef ARDUINO_API_H
#define ARDUINO_API_H

// version 1.2.0
#define ARDUINO_API_VERSION 10200
// version 1.5.2
#define ARDUINO_API_VERSION 10502

#include "Binary.h"

Expand All @@ -32,7 +32,7 @@
#include "Printable.h"
#include "PluggableUSB.h"
#include "Server.h"
#include "WString.h"
#include "String.h"
#include "Stream.h"
#include "Udp.h"
#include "USBAPI.h"
Expand All @@ -46,9 +46,10 @@
#include <string.h>
#include <math.h>

#ifdef __cplusplus
// Misc Arduino core functions
#include "Common.h"

#ifdef __cplusplus
// Compatibility layer for older code
#include "Compat.h"
#endif
Expand Down
46 changes: 46 additions & 0 deletions ArduinoCore-API/api/CanMsg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
CanMsg.cpp - Library for CAN message handling
Copyright (c) 2023 Arduino. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include "CanMsg.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace arduino
{

/**************************************************************************************
* STATIC CONST DEFINITION
**************************************************************************************/

uint8_t const CanMsg::MAX_DATA_LENGTH;
uint32_t const CanMsg::CAN_EFF_FLAG;
uint32_t const CanMsg::CAN_SFF_MASK;
uint32_t const CanMsg::CAN_EFF_MASK;

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* arduino */
156 changes: 156 additions & 0 deletions ArduinoCore-API/api/CanMsg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
CanMsg.h - Library for CAN message handling
Copyright (c) 2023 Arduino. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef ARDUINOCORE_API_CAN_MSG_H_
#define ARDUINOCORE_API_CAN_MSG_H_

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include <inttypes.h>
#include <string.h>

#include "Print.h"
#include "Printable.h"
#include "Common.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace arduino
{

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/

class CanMsg : public Printable
{
public:
static uint8_t constexpr MAX_DATA_LENGTH = 8;

static uint32_t constexpr CAN_EFF_FLAG = 0x80000000U;
static uint32_t constexpr CAN_SFF_MASK = 0x000007FFU; /* standard frame format (SFF) */
static uint32_t constexpr CAN_EFF_MASK = 0x1FFFFFFFU; /* extended frame format (EFF) */


CanMsg(uint32_t const can_id, uint8_t const can_data_len, uint8_t const * can_data_ptr)
: id{can_id}
, data_length{min(can_data_len, MAX_DATA_LENGTH)}
, data{0}
{
if (data_length && can_data_ptr)
memcpy(data, can_data_ptr, data_length);
}

CanMsg() : CanMsg(0, 0, nullptr) { }

CanMsg(CanMsg const & other)
{
id = other.id;
data_length = other.data_length;
if (data_length > 0)
memcpy(data, other.data, data_length);
}

virtual ~CanMsg() { }

CanMsg & operator = (CanMsg const & other)
{
if (this != &other)
{
id = other.id;
data_length = other.data_length;
if (data_length > 0)
memcpy(data, other.data, data_length);
}
return (*this);
}

virtual size_t printTo(Print & p) const override
{
char buf[20] = {0};
size_t len = 0;

/* Print the header. */
if (isStandardId())
len = snprintf(buf, sizeof(buf), "[%03" PRIX32 "] (%d) : ", getStandardId(), data_length);
else
len = snprintf(buf, sizeof(buf), "[%08" PRIX32 "] (%d) : ", getExtendedId(), data_length);
size_t n = p.write(buf, len);

/* Print the data. */
for (size_t d = 0; d < data_length; d++)
{
len = snprintf(buf, sizeof(buf), "%02X", data[d]);
n += p.write(buf, len);
}

/* Wrap up. */
return n;
}


uint32_t getStandardId() const {
return (id & CAN_SFF_MASK);
}
uint32_t getExtendedId() const {
return (id & CAN_EFF_MASK);
}
bool isStandardId() const {
return ((id & CAN_EFF_FLAG) == 0);
}
bool isExtendedId() const {
return ((id & CAN_EFF_FLAG) == CAN_EFF_FLAG);
}


/*
* CAN ID semantics (mirroring definition by linux/can.h):
* |- Bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
* |- Bit 30 : reserved (future remote transmission request flag)
* |- Bit 29 : reserved (future error frame flag)
* |- Bit 0-28 : CAN identifier (11/29 bit)
*/
uint32_t id;
uint8_t data_length;
uint8_t data[MAX_DATA_LENGTH];
};

/**************************************************************************************
* FREE FUNCTIONS
**************************************************************************************/

inline uint32_t CanStandardId(uint32_t const id) {
return (id & CanMsg::CAN_SFF_MASK);
}

inline uint32_t CanExtendedId(uint32_t const id) {
return (CanMsg::CAN_EFF_FLAG | (id & CanMsg::CAN_EFF_MASK));
}

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* arduino */

#endif /* ARDUINOCORE_API_CAN_MSG_H_ */
Loading
Loading