Skip to content

Commit

Permalink
Merge branch 'mac-can:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
uv-software authored Mar 29, 2024
2 parents 45d891d + ddd0ea4 commit c70b209
Show file tree
Hide file tree
Showing 100 changed files with 3,627 additions and 2,792 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Auto detect text files and perform LF normalization
* text=auto

# Never modify line endings of bash scripts
*.sh text eol=lf
18 changes: 18 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Makefile CI

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

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Build
run: make clean all
40 changes: 40 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: MSBuild

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

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: Build for x64
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: ${{env.SOLUTION_FILE_PATH}}\x64_build.bat NOVARS NOTRIAL
44 changes: 37 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
#.gitignore
Sources/CANAPI/.svn
Sources/build_no.h
Sources/CANAPI/.svn
Trial/.objects
Trial/SerialCAN
Trial/.vs
Trial/x64
Trial/x86
Trial/Debug
Trial/Release
Trial/slc_test
Trial/slc_test.exe
Trial/*.sln
Trial/*.vcxproj.user
Libraries/CANAPI/.objects
Libraries/CANAPI/libUVCANSLC.*
Libraries/CANAPI/libuvslcan.*
Libraries/CANAPI/.vs
Libraries/CANAPI/x64
Libraries/CANAPI/x86
Libraries/CANAPI/Debug_dll
Libraries/CANAPI/Debug_lib
Libraries/CANAPI/Release_dll
Libraries/CANAPI/Release_lib
Libraries/CANAPI/uvcanslc
Libraries/CANAPI/*.so.*
Libraries/CANAPI/*.dylib
Libraries/CANAPI/*.sln
Libraries/CANAPI/*.aps
Libraries/CANAPI/*.vcxproj.user
Libraries/SerialCAN/.objects
Libraries/SerialCAN/libSerialCAN.*
Libraries/SerialCAN/libserialcan.*
Libraries/SerialCAN/.vs
Libraries/SerialCAN/x64
Libraries/SerialCAN/x86
Libraries/SerialCAN/Debug_dll
Libraries/SerialCAN/Debug_lib
Libraries/SerialCAN/Release_dll
Libraries/SerialCAN/Release_lib
Libraries/SerialCAN/SerialCAN
Libraries/SerialCAN/*.so.*
Libraries/SerialCAN/*.dylib
Libraries/SerialCAN/*.sln
Libraries/SerialCAN/*.aps
Libraries/SerialCAN/*.vcxproj.user
Libraries/SLCAN/.objects
Libraries/SLCAN/libSLCAN.*
Libraries/SLCAN/libslcan.*
Expand All @@ -17,9 +47,9 @@ Utilities/can_moni/can_moni
Utilities/can_test/.objects
Utilities/can_test/can_test
SerialCAN-cppcheck-build-dir
checker.txt
Binaries
Includes
Testing
checker.txt
.vscode
*.log
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

25 changes: 13 additions & 12 deletions Examples/Python/CANAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# CAN Interface API, Version 3 (Python Wrapper)
#
# Copyright (c) 2005-2022 Uwe Vogt, UV Software, Berlin ([email protected])
# Copyright (c) 2005-2024 Uwe Vogt, UV Software, Berlin ([email protected])
# All rights reserved.
#
# This file is part of CAN API V3.
Expand Down Expand Up @@ -43,7 +43,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CAN API V3. If not, see <http://www.gnu.org/licenses/>.
# along with CAN API V3. If not, see <https://www.gnu.org/licenses/>.
#
"""
CAN API V3 Python Wrapper for generic CAN Interfaces.
Expand All @@ -54,7 +54,7 @@
$Author: haumea $
$Rev: 1046 $
$Rev: 1258 $
"""
from ctypes import *
import platform
Expand All @@ -69,7 +69,7 @@

# CAN API V3 - Python Wrapper
#
CAN_API_V3_PYTHON = {'major': 0, 'minor': 1, 'patch': 1}
CAN_API_V3_PYTHON = {'major': 0, 'minor': 2, 'patch': 0}

# CAN Identifier Ranges
#
Expand Down Expand Up @@ -158,8 +158,8 @@

# General CAN error codes (negative)
# Note: Codes less or equal than -100 are for vendor-specific error codes
# and codes less or equal than -10000 are for OS-specific error codes
# (add 10000 to get the reported OS error code, e.g. errno).
# and codes less or equal than -10000 are for OS-specific error codes
# (add 10000 to get the reported OS error code, e.g. errno).
#
CANERR_NOERROR = 0 # no error!
CANERR_BOFF = (-1) # CAN - busoff status
Expand All @@ -176,7 +176,7 @@
CANERR_LEC_CRC = (-16) # LEC - checksum error
CANERR_TX_BUSY = (-20) # USR - transmitter busy
CANERR_RX_EMPTY = (-30) # USR - receiver empty
CANERR_ERR_FRAME = (-40) # USR - error frame
CANERR_QUE_OVR = (-40) # USR - queue overrun
CANERR_TIMEOUT = (-50) # USR - time-out
CANERR_RESOURCE = (-90) # USR - resource allocation
CANERR_BAUDRATE = (-91) # USR - illegal baudrate
Expand Down Expand Up @@ -210,8 +210,9 @@

# Control of blocking read
#
CANREAD_INFINITE = c_uint16(65535) # infinite time-out (blocking read)

CANWAIT_INFINITE = 65535 # infinite time-out (blocking operation)
CANREAD_INFINITE = CANWAIT_INFINITE
CANWRITE_INFINITE = CANWAIT_INFINITE

# CAN Status-register
#
Expand Down Expand Up @@ -324,7 +325,7 @@ class SpeedNominal(LittleEndianStructure):
CAN Nominal Transmission Rate
"""
_fields_ = [
('fdoe', c_bool),
('_reserved', c_bool),
('speed', c_float),
('samplepoint', c_float),
]
Expand All @@ -335,7 +336,7 @@ class SpeedData(LittleEndianStructure):
CAN Data Transmission Rate
"""
_fields_ = [
('brse', c_bool),
('_reserved', c_bool),
('speed', c_float),
('samplepoint', c_float),
]
Expand Down Expand Up @@ -762,5 +763,5 @@ def len2dlc(length):
# have a great time
print('Bye, bye!')

# * $Id: CANAPI.py 1046 2022-03-08 20:38:47Z haumea $ *** (c) UV Software, Berlin ***
# * $Id: CANAPI.py 1258 2024-03-19 21:35:15Z haumea $ *** (c) UV Software, Berlin ***
#
6 changes: 3 additions & 3 deletions Examples/Python/CANAPI_SerialCAN.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
#
# SerialCAN - CAN API V3 Driver for CAN over Serial-line Interfaces
# SerialCAN - CAN API V3 Driver for CAN-over-Serial-Line Interfaces
#
# Copyright (c) 2020-2022 Uwe Vogt, UV Software, Berlin ([email protected])
# Copyright (c) 2020-2024 Uwe Vogt, UV Software, Berlin ([email protected])
# All rights reserved.
#
# This file is part of SerialCAN.
Expand Down Expand Up @@ -54,7 +54,7 @@
$Author: makemake $
$Rev: 1049 $
$Rev: 1261 $
"""
from CANAPI import *
from ctypes import *
Expand Down
6 changes: 3 additions & 3 deletions Examples/Python/can_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def sigterm(signo, frame):
if platform.system() == 'Darwin':
# macOS dynamic library
lib = 'libUVCANSLC.dylib'
com = '/dev/tty.usbserial-LW4KOZQW'
com = '/dev/tty.usbserial-LW917KWK'
elif platform.system() != 'Windows':
# shared object library
lib = 'libuvcanslc.so'
com = '/dev/ttyUSB0'
com = '/dev/ttyUSB1'
else:
# Windows DLL
lib = 'u3canslc.dll'
com = '\\\\.\\COM4'
com = '\\\\.\\COM6'
num = 1 + CAN_MAX_STD_ID

# parse the command line
Expand Down
34 changes: 19 additions & 15 deletions Libraries/CANAPI/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SerialCAN - CAN API V3 Driver for CAN over Serial-line Interfaces
# SerialCAN - CAN API V3 Driver for CAN-over-Serial-Line Interfaces
#
# Copyright (c) 2020-2022 Uwe Vogt, UV Software, Berlin ([email protected])
# Copyright (c) 2020-2024 Uwe Vogt, UV Software, Berlin ([email protected])
# All rights reserved.
#
# This file is part of SerialCAN.
Expand Down Expand Up @@ -42,14 +42,25 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SerialCAN. If not, see <http://www.gnu.org/licenses/>.
# along with SerialCAN. If not, see <https://www.gnu.org/licenses/>.
#
current_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown OS')
current_OS := $(patsubst CYGWIN%,Cygwin,$(current_OS))
current_OS := $(patsubst MINGW%,MinGW,$(current_OS))
current_OS := $(patsubst MSYS%,MinGW,$(current_OS))

MAJOR = 0
MINOR = 1
PATCH = 1

ifeq ($(PATCH),0)
VERSION = $(MAJOR).$(MINOR)
else
VERSION = $(MAJOR).$(MINOR).$(PATCH)
endif

HOME_DIR = ../..
MAIN_DIR = .

SOURCE_DIR = $(HOME_DIR)/Sources
SERIAL_DIR = $(HOME_DIR)/Sources/SLCAN
Expand All @@ -65,16 +76,11 @@ ifeq ($(current_OS),Darwin) # macOS - libUVCANSLC.dylib

LIBRARY = libUVCANSLC

MAJOR = 0
MINOR = 1
PATCH = 0

VERSION = $(MAJOR).$(MINOR)
TARGET = $(LIBRARY).$(VERSION).dylib
STATIC = $(LIBRARY).a

INSTALL_NAME = $(TARGET)
CURRENT_VERSION = $(MAJOR).$(MINOR).0
CURRENT_VERSION = $(MAJOR).$(MINOR).$(PATCH)
COMPATIBILITY_VERSION = $(MAJOR).$(MINOR).0

INSTALL = /usr/local/lib
Expand Down Expand Up @@ -129,11 +135,6 @@ ifeq ($(current_OS),$(filter $(current_OS),Linux Cygwin)) # linux - libuvcanslc.

LIBRARY = libuvcanslc

MAJOR = 0
MINOR = 1
PATCH = 0

VERSION = $(MAJOR).$(MINOR)
SONAME = $(LIBRARY).so.1
TARGET = $(SONAME).$(VERSION)
STATIC = $(LIBRARY).a
Expand All @@ -143,6 +144,7 @@ INSTALL = /usr/local/lib
INCLUDE = /usr/local/include

DEFINES = -DOPTION_CAN_2_0_ONLY=0 \
-DOPTION_CANAPI_SERIALCAN_SO=1 \
-DOPTION_CANAPI_DRIVER=1 \
-DOPTION_CANAPI_RETVALS=1 \
-DOPTION_CANAPI_COMPANIONS=1 \
Expand Down Expand Up @@ -203,9 +205,11 @@ bindir:
incdir:
@mkdir -p $(INCDIR)
$(CP) $(SOURCE_DIR)/SerialCAN_Defines.h $(INCDIR)
$(CP) $(CANAPI_DIR)/can_api.h $(INCDIR)
$(CP) $(CANAPI_DIR)/CANAPI_Types.h $(INCDIR)
$(CP) $(CANAPI_DIR)/CANAPI_Defines.h $(INCDIR)
$(CP) $(CANAPI_DIR)/CANBTR_Defaults.h $(INCDIR)
$(CP) $(CANAPI_DIR)/can_api.h $(INCDIR)
$(CP) $(CANAPI_DIR)/can_btr.h $(INCDIR)

clean:
$(RM) $(TARGET) $(STATIC) $(OUTDIR)/*.o $(OUTDIR)/*.d
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions Libraries/CANAPI/Sources/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by u3canslc.rc

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Binary file added Libraries/CANAPI/uvcanslc.rc
Binary file not shown.
Loading

0 comments on commit c70b209

Please sign in to comment.