Skip to content

Commit

Permalink
Midnight SUN
Browse files Browse the repository at this point in the history
  • Loading branch information
Akashem06 committed Sep 21, 2024
1 parent 720345d commit 47c113d
Show file tree
Hide file tree
Showing 46 changed files with 38,726 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Project .clang-format Settings
# This is a .yaml file.

# The documentation for clang-format can be found on
# https://clang.llvm.org/docs/ClangFormat.html

# The style we are using is strongly based on the Google style guide for C++.
# Notable changes include:
# ColumnLimit: 100
# PointerAlignment: Right
# Cpp11BracedListStyle: false

# For struct initializers the preferred initializer format is:
# MyStruct my_struct = {
# .field1 = 1, //
# .field2 = 2, //
# };
# Note: the need for the comment to force the line break and the trailing comma
# to force the braces to break.
# For more details on the initializer style and solution see:
# https://stackoverflow.com/questions/33656800/clang-format-line-breaks

Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never

92 changes: 92 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
# Run on all pull requests and all pushes to main
push:
branches: [main]
pull_request:

# Allow running this workflow manually
workflow_dispatch:

env:
# Set defines for builds/tests
DEFINES: "LOG_LEVEL=LOG_LEVEL_WARN"

jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 12
steps:
- uses: actions/checkout@v3

- name: Get and run setup script
run: |
wget https://raw.githubusercontent.com/uw-midsun/box/master/requirements.sh
chmod +x ./requirements.sh
sudo ./requirements.sh
pip install -r requirements.txt --upgrade
- name: Install STM32 toolchain
env:
GCC_PATH: gcc-arm-none-eabi-8-2019-q3-update
GCC_ARCHIVE_PATH: gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2
GCC_URL: https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2
run: |
cd ${HOME}
wget -nv $GCC_URL
mkdir -p $GCC_PATH
tar -xjf $GCC_ARCHIVE_PATH
echo "${HOME}/${GCC_PATH}/bin" >> $GITHUB_PATH
- name: Force PATH to update
run: hash -r

- name: Print versions of everything
run: |
arm-none-eabi-gcc --version
arm-none-eabi-objcopy --version
arm-none-eabi-objdump --version
arm-none-eabi-size --version
arm-none-eabi-gcc-ar --version
arm-none-eabi-gdb --version
gcc --version
make --version
clang --version
clang-format --version
pylint --version
- name: Format and lint
run: |
scons format
if [[ $(git diff --name-only) ]] ; then
echo -e "\n unformatted files:";
git diff --name-only;
exit 1;
fi
scons lint
if [ $? -ne 0 ] ; then
echo -e "\n lint failed";
exit 1;
fi
- name: Build stm32f10x
id: build-stm32
run: |
scons --platform=arm --define="${DEFINES}"
- name: Build and test
id: build-test
run: |
# Setting up vcan
sudo apt-get install -y linux-modules-extra-$(uname -r)
sudo modprobe can
sudo modprobe can_raw
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
scons --platform=x86 --define="${DEFINES}"
scons test --platform=x86 --define="${DEFINES}"
# missing make pytest_all
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# build directory
build/*

# scons cache
.sconsign.dblite

# Other
*.vscode
.vs/
build/
*.DS_Store
.project
*.code-workspace

# Vim
tags
TAGS
.ycm_extra_conf.py
*.swp
__pycache__

# Python generated code
*.pyc

# Autogenerated code
*can_board_ids.h
*system_can.dbc
*can_sim.py
x86_flash

py/can/can.py
py/can/messages.py
15 changes: 15 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set noparent

linelength=100

# exclude copyright warnings
filter=-legal

# ignore Include the directory when naming .h files
filter=-build/include_subdir

# ignore warnings about C-style casts (since we are in fact using C)
filter=-readability/casting

# ignore missing username in TODO
filter=-readability/todo
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Midnight Sun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 47c113d

Please sign in to comment.