Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
531fe9e
rename software folder to firmware
changxu-liu Jan 16, 2026
c2729b9
set up embedded sharepoint
changxu-liu Jan 17, 2026
d847496
fix makefile showing flash successful even when not (fix in Embedded-…
changxu-liu Jan 28, 2026
0273a31
MCP23S17 GPIO expander driver
changxu-liu Jan 31, 2026
23f06cb
update makefile to give build failure message, remove madefile when r…
changxu-liu Jan 31, 2026
f1067b1
add blank line to nix_thing.sh
changxu-liu Jan 31, 2026
72e8923
fix TEST capitalization in makefile, change formatting
changxu-liu Mar 6, 2026
f50f21d
add MCP23S17 datasheet
changxu-liu Mar 6, 2026
5b82495
change pin type to uint16_t because HAL convention
changxu-liu Mar 6, 2026
9d4e8af
add register descriptions
changxu-liu Mar 7, 2026
92ac175
add enum comments
changxu-liu Mar 7, 2026
3ffdfe0
address addressing double left-shift, comments
changxu-liu Mar 7, 2026
7994c8b
move defines out of c file to header file
changxu-liu Mar 7, 2026
d17c3b5
update function documentation comments, add comments for static funct…
changxu-liu Mar 7, 2026
c0c8f16
remove unnecessary comment
changxu-liu Mar 7, 2026
74c2594
function comment update
changxu-liu Mar 7, 2026
ac404d7
change functions to return status
changxu-liu Mar 7, 2026
42ed81a
make more functions return status
changxu-liu Mar 7, 2026
454a561
update documentation returning status, other things
changxu-liu Mar 8, 2026
191f4fa
improve addressing comment
changxu-liu Mar 8, 2026
d494a91
move uint8_to_binary_str to utilities file
changxu-liu Mar 8, 2026
9e15fbf
add pin defines to file
changxu-liu Mar 8, 2026
acb3c0a
add descriptions to tests
changxu-liu Mar 13, 2026
a62ba02
add blank lines
changxu-liu Mar 13, 2026
38f02fe
add todo
changxu-liu Mar 31, 2026
fcd25b8
add _t to type names for enums and structs
changxu-liu Apr 4, 2026
f210241
RTOSify MCP23S17 driver
changxu-liu Apr 4, 2026
2b61d4e
update constant names, update comments, clean up
changxu-liu Apr 4, 2026
ac748de
update MCP23S17 init function for less arguments, change configuratio…
changxu-liu Apr 4, 2026
da3d30f
updated MCP23S17 test for RTOS - untested as don't have TestBoard_TPS…
changxu-liu Apr 5, 2026
6ec641c
add github build action
changxu-liu Apr 5, 2026
513e7b6
add github build action (attempt 2)
changxu-liu Apr 5, 2026
b470d51
add github build action (attempt 3)
changxu-liu Apr 5, 2026
014a6b4
add github build action (attempt 4)
changxu-liu Apr 5, 2026
254f5c3
add github build action (attempt 5)
changxu-liu Apr 5, 2026
a231b80
add github build action (attempt 6)
changxu-liu Apr 5, 2026
9aaf389
add units to SPI delay names
changxu-liu Apr 5, 2026
2045a89
fix tests
changxu-liu Apr 5, 2026
212da27
change Pins, SPI, and UART files structure
changxu-liu Apr 5, 2026
c2149ce
add device and data null check
changxu-liu Apr 6, 2026
fdd8b82
move encoding of data before taking SPI mutex
changxu-liu Apr 6, 2026
e24da2b
move CS stuff to static inline function
changxu-liu Apr 6, 2026
637bdbd
lakshay being picky picky picky
changxu-liu Apr 6, 2026
9ecf93c
fix spi cs and mutex not returning to original state if spi transmiss…
changxu-liu Apr 6, 2026
ed9f7fb
fix discarding status return if not 🙂 (as now there's more statuses)
changxu-liu Apr 6, 2026
ab3dcf1
fix spi cs and mutex not returning to original state if HAL spi funct…
changxu-liu Apr 6, 2026
2d54ef9
lakshay lies
changxu-liu Apr 6, 2026
6258117
put SPI message length into variable
changxu-liu Apr 6, 2026
b19b3a8
add checks for spi mutex and sempahore null
changxu-liu Apr 6, 2026
28ad4b6
move SPI interrupt functions ot SPI file
changxu-liu Apr 6, 2026
19e3f9b
move SPI mutex and done semaphore setup to function in SPI file
changxu-liu Apr 6, 2026
2a20d58
make SPI interrupt priority a define
changxu-liu Apr 6, 2026
09a9835
move private functions to c file
changxu-liu Apr 12, 2026
9edfb8f
fix dummy send failures potential to lock up SPI mutex
changxu-liu Apr 12, 2026
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
37 changes: 36 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# -----------------------------------------------------------------------------
# HARDWARE (KICAD)
# -----------------------------------------------------------------------------
# For PCBs designed using KiCad: https://www.kicad.org/
# Format documentation: https://kicad.org/help/file-formats/

Expand Down Expand Up @@ -37,4 +40,36 @@ fp-info-cache
**/*-backups/*.zip

# Local project settings
*.kicad_prl
*.kicad_prl

# -----------------------------------------------------------------------------
# FIRMWARE
# -----------------------------------------------------------------------------

# VS Code
.vscode/
compile_commands.json

# Build files
build
.dockerfile.hash
.cache
/can/CANMetaData.*
Madefile

# Python
*venv
__pycache__/
.env

# Nix
flake.lock

# Documentation toolset
docs/doxygen/
site/*
!site/empty.a
Zone.Identifier

# Mac specific files
.DS_Store
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "hardware/lib/KiCAD-Sharepoint"]
path = hardware/lib/KiCAD-Sharepoint
url = git@github.com:lhr-solar/KiCAD-Sharepoint.git
[submodule "firmware/Embedded-Sharepoint"]
path = firmware/Embedded-Sharepoint
url = git@github.com:lhr-solar/Embedded-Sharepoint.git
1 change: 1 addition & 0 deletions firmware/Embedded-Sharepoint
Submodule Embedded-Sharepoint added at 2bdaa5
157 changes: 157 additions & 0 deletions firmware/TestBoard_TPS27SA08-Q1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# CRAZY COLORS ----------------------------------------------------------------
RED=\033[0;31m
GREEN=\033[0;32m
ORANGE=\033[0;33m
BLUE=\033[0;34m
PURPLE=\033[0;35m
CYAN=\033[0;36m
LIGHTGRAY=\033[0;37m
DARKGRAY=\033[1;30m
YELLOW=\033[0;33m
NC=\033[0m # No Color
# -----------------------------------------------------------------------------

# generate paths
MAKEFILE_DIR = $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

# PROJECT CONFIGURATION -------------------------------------------------------
TEST ?= main

# COMMON TARGETS
# LSOM: stm32g473xx
# PSOM: stm32l431cbt
# FAT NUCLEO: stm32g474xx
# BAD NUCLEO: stm32l432kcu
PROJECT_TARGET ?= stm32l432kcu

# SOURCE AND INCLUDE DIRECTORIES
PROJECT_C_INCLUDES = $(wildcard core/inc) $(wildcard ../driver/inc)
PROJECT_C_SOURCES = $(wildcard core/src/*.c) $(wildcard ../driver/src/*.c)
PROJECT_MAIN_DIR ?= core/src

# BUILD DIRECTORIES
PROJECT_BUILD_DIR = build
BUILD_MAKEFILE_DIR ?= ../Embedded-Sharepoint

MADEFILE ?= true
MADEFILE_DIR = ${MAKEFILE_DIR}
# -----------------------------------------------------------------------------


# remove main and add test folders if running test
ifneq ($(TEST), "main")
PROJECT_C_SOURCES := $(filter-out $(PROJECT_MAIN_DIR)/main.c, $(PROJECT_C_SOURCES))
PROJECT_C_SOURCES += $(wildcard test/src/${test}.c)

PROJECT_C_INCLUDES += $(wildcard /test/inc)
endif
Comment thread
changxu-liu marked this conversation as resolved.

# Convert relative paths to absolute paths for passing to Embedded-Sharepoint build
PROJECT_C_SOURCES := $(addprefix $(MAKEFILE_DIR)/, $(PROJECT_C_SOURCES))
PROJECT_C_INCLUDES := $(addprefix $(MAKEFILE_DIR)/, $(PROJECT_C_INCLUDES))

# Debug
PRINT_DEBUG ?= true

ifeq ($(PRINT_DEBUG), true)
$(info SOURCES: $(PROJECT_C_SOURCES))
$(info INCLUDES: $(PROJECT_C_INCLUDES))
endif

# generate paths (cont.d)
PROJECT_BUILD_DIR := $(addprefix $(MAKEFILE_DIR)/, $(PROJECT_BUILD_DIR))

# export variables
export PROJECT_TARGET
export PROJECT_C_SOURCES
export PROJECT_C_INCLUDES
export PROJECT_BUILD_DIR


# -----------------------------------------------------------------------------
# Clang
BEAR_PREFIX :=
# check if bear is installed
BEAR_INSTALLED := $(shell command -v bear >/dev/null 2>&1 && echo yes || echo no)

# define path of .vscode (create if missing)
VS_CODE_DIR := $(MAKEFILE_DIR)/.vscode
$(shell mkdir -p $(VS_CODE_DIR))

ifeq ($(BEAR_INSTALLED),yes)
BEAR_PREFIX := bear --output $(VS_CODE_DIR)/compile_commands.json --append --
endif
# -----------------------------------------------------------------------------


# BUILD -----------------------------------------------------------------------
ifeq ($(MAKECMDGOALS),)
default: build_code
else ifeq ($(MAKECMDGOALS), all)
all: build_code
else
%:
$(BEAR_PREFIX) $(MAKE) -C $(BUILD_MAKEFILE_DIR) $(MAKECMDGOALS)
endif


build_code:
ifeq ($(MADEFILE), true)
@echo -e "Make initiated at $(shell date)\n" > ${MADEFILE_DIR}/Madefile
endif

ifneq ($(TEST), main)
@echo -e "Making ${PURPLE}$(PROJECT_TARGET)${NC}build for ${BLUE}TEST=${PURPLE} ${TEST}${NC}"
ifeq ($(MADEFILE), true)
@echo -e "Making $(PROJECT_TARGET) build for TEST=${TEST}\n" >> ${MADEFILE_DIR}/Madefile
endif
Comment thread
changxu-liu marked this conversation as resolved.
else
@echo -e "Making ${PURPLE}$(PROJECT_TARGET)${NC}build with ${ORANGE}main.${NC}"
ifeq ($(MADEFILE), true)
@echo -e "Making $(PROJECT_TARGET) build with main.\n" >> ${MADEFILE_DIR}/Madefile
endif
endif

ifeq ($(MADEFILE), true)
@set -o pipefail; if $(BEAR_PREFIX) $(MAKE) -C $(BUILD_MAKEFILE_DIR) all -j | tee -a ${MADEFILE_DIR}/Madefile; then \
echo -e "${GREEN}Compiled! Splendid! Jolly Good!!!\n${NC}"; \
echo -e "\nCompiled! Splendid! Jolly Good!!\n" >> ${MADEFILE_DIR}/Madefile; \
else \
echo -e "${RED}Build failure.\n${NC}"; \
echo -e "\nBuild failure.\n" >> ${MADEFILE_DIR}/Madefile; \
exit 1; \
fi
else
@set -o pipefail; if $(BEAR_PREFIX) $(MAKE) -C $(BUILD_MAKEFILE_DIR) all -j; then \
echo -e "${GREEN}Compiled! Splendid! Jolly Good!!!\n${NC}"; \
else \
echo -e "${RED}Build failure.\n${NC}"; \
exit 1; \
fi
endif
# -----------------------------------------------------------------------------


# FLASH -----------------------------------------------------------------------
flash:
@set -o pipefail; if $(MAKE) -C $(BUILD_MAKEFILE_DIR) flash; then \
echo -e "${GREEN}Flash successful.\n${NC}"; \
else \
echo -e "${RED}Flash failure.\n${NC}"; \
exit 1; \
fi
# -----------------------------------------------------------------------------


# CLEAN -----------------------------------------------------------------------
clean:
$(MAKE) -C $(BUILD_MAKEFILE_DIR) clean
-rm -fR $(MADEFILE_DIR)/Madefile
# -----------------------------------------------------------------------------


# DOCUMENTATION ---------------------------------------------------------------
# .PHONY: docs
# docs:
# cd $(BUILD_MAKEFILE_DIR) && mkdocs serve
# -----------------------------------------------------------------------------
21 changes: 21 additions & 0 deletions firmware/TestBoard_TPS27SA08-Q1/core/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// main.c

// INCLUDES -------------------------------------------------------------------


// DEFINES --------------------------------------------------------------------


// CONFIGURATION HANDLES/STRUCTS ----------------------------------------------


// FUNCTION DECLARATIONS ------------------------------------------------------


// GLOBAL VARIABLES -----------------------------------------------------------


int main()
{
return 0;
}
Comment thread
changxu-liu marked this conversation as resolved.
Loading