Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7ae1240
stuff
dnakhooda Nov 16, 2025
19fea0a
stuff
dnakhooda Nov 16, 2025
8f32119
stuff
dnakhooda Nov 16, 2025
5a71e6a
stuff
dnakhooda Nov 16, 2025
dfef405
stuff
dnakhooda Nov 16, 2025
9ebb802
stuff
dnakhooda Nov 16, 2025
555ad5e
stuff
dnakhooda Nov 16, 2025
e9d677c
fix
dnakhooda Nov 16, 2025
c975cb5
small fix
dnakhooda Nov 23, 2025
c3f1d33
more
dnakhooda Nov 23, 2025
7af9d88
stuff
dnakhooda Nov 23, 2025
cb206f8
stuff
dnakhooda Nov 23, 2025
1a7414f
fix
dnakhooda Nov 23, 2025
ed2a2b6
fix
dnakhooda Nov 23, 2025
672fcfa
Merge branch 'sht30' into lsm6dsv
dnakhooda Nov 23, 2025
8981b05
fix
dnakhooda Nov 23, 2025
a259713
fix
dnakhooda Nov 23, 2025
4f817f3
fix
dnakhooda Nov 23, 2025
9508901
fix
dnakhooda Nov 23, 2025
54d5a1d
Merge branch 'sht30' into lsm6dsv
dnakhooda Nov 23, 2025
d5f8bdc
Merge branch 'main' into lsm6dsv
dnakhooda Dec 27, 2025
cb6a8cb
fix
dnakhooda Jan 13, 2026
6d79b78
add motion fx
dnakhooda Jan 18, 2026
504c3cb
fix pinout
dnakhooda Jan 18, 2026
c7b2da8
lis2mdl add
dnakhooda Jan 18, 2026
9da4c9d
fix
dnakhooda Jan 27, 2026
b7483fc
fix
dnakhooda Jan 27, 2026
cce14db
fix
dnakhooda Jan 27, 2026
652001e
fix
dnakhooda Jan 27, 2026
8f24dc7
fix
dnakhooda Jan 27, 2026
4297095
fix
dnakhooda Jan 27, 2026
f955185
fix
dnakhooda Jan 27, 2026
b75fafa
fix
dnakhooda Jan 27, 2026
b8c42be
update embedded-base
dnakhooda Jan 27, 2026
f24d6ed
remove inbox
dnakhooda Feb 1, 2026
e7423d0
update embedded base
dnakhooda Feb 1, 2026
622b141
gix thread sleep
dnakhooda Feb 1, 2026
a92cf79
tx_thread_sleep fix
dnakhooda Feb 1, 2026
a09bbae
imports change
dnakhooda Feb 1, 2026
c4c8ad3
ner timer
dnakhooda Feb 1, 2026
395b506
fix
dnakhooda Feb 1, 2026
2e9bed4
tx api
dnakhooda Feb 1, 2026
205b8a4
add tx_api.h
dnakhooda Feb 1, 2026
ac5126d
testing something
dnakhooda Feb 1, 2026
2a0460d
fix
dnakhooda Feb 1, 2026
1f9aca3
fix
dnakhooda Feb 1, 2026
50d0c32
fix
dnakhooda Feb 1, 2026
daefc05
final fix
dnakhooda Feb 1, 2026
8843b64
9x fix
dnakhooda Feb 4, 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
12 changes: 10 additions & 2 deletions .mxproject

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE

# Misc Embedded-Base Stuff (drivers, middleware, utils, etc.)
"../Drivers/Embedded-Base/general/src/sht30.c"
"../Drivers/Embedded-Base/general/src/lsm6dso_reg.c"
"../Drivers/Embedded-Base/general/src/lsm6dso.c"
"../Drivers/Embedded-Base/general/include/lsm6dsv_reg.h"
"../Drivers/Embedded-Base/general/src/lsm6dsv_reg.c"
"../Drivers/Embedded-Base/general/src/lis2mdl_reg.c"
"../Drivers/Embedded-Base/platforms/stm32h563/src/fdcan.c"
"./Drivers/Embedded-Base/middleware/src/bitstream.c"
"./Drivers/Embedded-Base/middleware/src/debounce.c"
"./Drivers/Embedded-Base/middleware/src/timer.c"
"./Drivers/Embedded-Base/middleware/src/c_utils.c"

# Repo Source Files
"./Core/Src/u_utils.c"
"./Core/Src/u_can.c"
"./Core/Src/u_mutexes.c"
"./Core/Src/u_queues.c"
Expand Down
4 changes: 2 additions & 2 deletions Core/Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ void Error_Handler(void);
#define TOF_RST_GPIO_Port GPIOE
#define TOF_LPN_Pin GPIO_PIN_5
#define TOF_LPN_GPIO_Port GPIOE
#define DEBUG_LED2_Pin GPIO_PIN_2
#define DEBUG_LED2_GPIO_Port GPIOG
#define DEBUG_LED1_Pin GPIO_PIN_3
#define DEBUG_LED1_GPIO_Port GPIOG
#define DEBUG_LED2_Pin GPIO_PIN_4
#define DEBUG_LED2_GPIO_Port GPIOG

/* USER CODE BEGIN Private defines */

Expand Down
6 changes: 5 additions & 1 deletion Core/Inc/u_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#include "u_tx_can.h"

#define SHT30_CAN_ID 0xFA
#define SHT30_CAN_ID 0xFA
#define IMU_ACCEL_CAN_ID 0xFC
#define IMU_GYRO_CAN_ID 0xFB
#define MAGNOMETER_CAN_ID 0XFD
#define ORIENTATION_CAN_ID 0XFD

// u_TODO - finish this file
64 changes: 60 additions & 4 deletions Core/Inc/u_sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,70 @@

#include <stdint.h>

#define MOTION_FX_STATE_SIZE (size_t)(2432)

/*
* Bias correction thresholds from MotionFX example implementations.
* Lower GBIAS_* = more correction, higher = more stability.
* Adjust if drift or instability occurs.
*/
#define GBIAS_ACC_TH_SC (2.0f * 0.000765f)
#define GBIAS_GYRO_TH_SC (2.0f * 0.002f)
#define GBIAS_MAG_TH_SC 0.0f

/*
* DECIMATION controls how often sensor data is processed.
* 1U = use every sample, higher = skip samples
* Increase to ignore more samples if CPU usage is too high.
*/
#define DECIMATION 1U

/**
* @brief initializes the lsm6dsv imu
* @return whether there were errors initializing the lsm6dsv imu
*/
uint16_t init_imu();

/**
* @brief initializes Magnetometer for reading
* @return returns tx status for errors
*/
uint16_t init_magnetometer();

/**
* @brief reads data from the lsm6dsv and lis2mdl, and performs motionfx rotation calculations
* @return whether there were errors in reading the data
*/
uint16_t read_imu_and_magnometer();

/**
* @brief sends data from the lsm6dsv, lis2mdl, and motionfx rotation data over CAN
*/
void send_imu_and_magnometer_data();

/**
* @brief initializes the motion fx library
*/
void motion_fx_init();

/**
* @brief zeros the motion fx rotation data
*/
void calibrate();

/**
* @brief initializes the sht30 for reading temp and humidity
* @return whether there were errors initializing the sht30
*/
uint8_t init_sht30();
uint16_t init_sht30();

/**
* @brief reads temp and humidity data from the sht30
* @return whether there were errors in reading the data
*/
uint16_t read_sht30();

/**
* @brief reads and sends temp and humidity data from the sht30
* @return whether there were errors in reading/sending the data
* @brief sends temp and humidity data from the sht30 over CAN
*/
uint8_t read_sht30();
void send_sht30_data();
10 changes: 10 additions & 0 deletions Core/Inc/u_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

/**
* Converts a float to a 16 bit integer.
*
* @param value The float value to be converted
*
* @return The converted 16 bit integer
*/
int16_t float_to_int16(float value);
5 changes: 4 additions & 1 deletion Core/Src/app_threadx.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ UINT App_ThreadX_Init(VOID *memory_ptr)

/* Init user-written code that uses ThreadX stuff here. */
CATCH_ERROR(queues_init(byte_pool), U_SUCCESS);
CATCH_ERROR(threads_init(byte_pool), U_SUCCESS);
CATCH_ERROR(mutexes_init(), U_SUCCESS);
CATCH_ERROR(init_imu(), U_SUCCESS);
CATCH_ERROR(init_magnetometer(), U_SUCCESS);
CATCH_ERROR(init_sht30(), U_SUCCESS);
motion_fx_init();
CATCH_ERROR(threads_init(byte_pool), U_SUCCESS);

/* USER CODE END App_ThreadX_MEM_POOL */
/* USER CODE BEGIN App_ThreadX_Init */
Expand Down
Loading