Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion sensor_nodes/.project
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
</projectDescription>
1 change: 0 additions & 1 deletion sensor_nodes/Core/Inc/FEB_CAN_Library_SN4
Submodule FEB_CAN_Library_SN4 deleted from 0e482a
12 changes: 11 additions & 1 deletion sensor_nodes/Core/Inc/FEB_Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@

// ******************************** Configuration ********************************

#define IS_FRONT_NODE
#define IS_FRONT_NODE 1

// For isolating one sensor
#define SEND_CAN 0

#define WSS 1
#define TIRETEMP 0
#define ADCS 0
#define STEER 0
#define IMU 0
#define GPS 0

// ******************************** Functions ********************************

Expand Down
2 changes: 0 additions & 2 deletions sensor_nodes/Core/Inc/FEB_WSS.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

// **************************************** Configuration ****************************************

#define DEBUG_READ_WSS

// **************************************** Functions ****************************************

void WSS_Init(void);
Expand Down
68 changes: 48 additions & 20 deletions sensor_nodes/Core/Src/FEB_Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,38 @@ extern CAN_HandleTypeDef hcan1;

void FEB_Main_Setup(void) {

// // Start CAN
HAL_CAN_Start(&hcan1);
if (HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)
{
Error_Handler();
}

WSS_Init();
#if SEND_CAN
// Start CAN
HAL_CAN_Start(&hcan1);
if (HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)
{
Error_Handler();
}
#endif

// Initialize Steering Encoder
Steer_ENC_I2C_Init();
Steer_ENC_I2C_Full_Read(); // Do an initial full read
#if WSS
WSS_Init();
#endif

#if TIRETEMP
Tire_Temp_Init();
#endif

// I2C_Scan();
#if ADCS
ADC_Init();
#endif

BNO08X_Init();
#if STEER
// Initialize Steering Encoder
Steer_ENC_I2C_Init();
Steer_ENC_I2C_Full_Read(); // Do an initial full read
#endif

ADC_Init();
#if IMU
// I2C_Scan();
BNO08X_Init();
#endif

HAL_TIM_Base_Start_IT(&htim6); // Start 1 ms timer

Expand All @@ -48,16 +60,32 @@ void FEB_Main_While(void) {

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM6) {
#if WSS
WSS_Main();
#endif

#if TIRETEMP
Tire_Temp_Main();
#endif

#if ADCS
ADC_Main();
#endif

#if STEER
Steer_ENC_Main();
#endif

#if SWITCH
Coolant_ReedSW_Main();
#endif

#if IMU
IMU_Main();
#endif

#ifdef IS_FRONT_NODE
Steer_ENC_Main();
#else
Coolant_ReedSW_Main();
IMU_Main();
GPS_Main();
#endif
#if GPS
GPS_Main();
#endif
}
}
14 changes: 8 additions & 6 deletions sensor_nodes/Core/Src/FEB_WSS.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,19 @@ void WSS_Main(void)
wss_left = (uint8_t) ((float) ticks_left * TIMER_ELAPSED_HZ / TICKS_PER_ROTATION * 60);

// Send the wheel speed data
#ifdef DEBUG_READ_WSS
#if WSS
printf("Right: %c%d rpm %d mph\tLeft: %c%d %d mph\r\n", direction_right, wss_right, direction_left, wss_left, (int) (wss_right * RPM_to_MPH), (int) (wss_left * RPM_to_MPH));
#endif

#if IS_FRONT_NODE & SEND_CAN
CAN_Transmit(CAN_ID_WSS_FRONT, WSS_Data);
#elseif SEND_CAN
CAN_Transmit(CAN_ID_WSS_REAR, WSS_Data);
#endif

Fill_WSS_Data();

#ifdef IS_FRONT_NODE
CAN_Transmit(CAN_ID_WSS_FRONT, WSS_Data);
#else
CAN_Transmit(CAN_ID_WSS_REAR, WSS_Data);
#endif


}

176 changes: 176 additions & 0 deletions sensor_nodes/Core/Src/syscalls.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/**
******************************************************************************
* @file syscalls.c
* @author Auto-generated by STM32CubeIDE
* @brief STM32CubeIDE Minimal System calls file
*
* For more information about which c-functions
* need which of these lowlevel functions
* please consult the Newlib libc-manual
******************************************************************************
* @attention
*
* Copyright (c) 2020-2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/

/* Includes */
#include <sys/stat.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>


/* Variables */
extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));


char *__env[1] = { 0 };
char **environ = __env;


/* Functions */
void initialise_monitor_handles()
{
}

int _getpid(void)
{
return 1;
}

int _kill(int pid, int sig)
{
(void)pid;
(void)sig;
errno = EINVAL;
return -1;
}

void _exit (int status)
{
_kill(status, -1);
while (1) {} /* Make sure we hang here */
}

__attribute__((weak)) int _read(int file, char *ptr, int len)
{
(void)file;
int DataIdx;

for (DataIdx = 0; DataIdx < len; DataIdx++)
{
*ptr++ = __io_getchar();
}

return len;
}

__attribute__((weak)) int _write(int file, char *ptr, int len)
{
(void)file;
int DataIdx;

for (DataIdx = 0; DataIdx < len; DataIdx++)
{
__io_putchar(*ptr++);
}
return len;
}

int _close(int file)
{
(void)file;
return -1;
}


int _fstat(int file, struct stat *st)
{
(void)file;
st->st_mode = S_IFCHR;
return 0;
}

int _isatty(int file)
{
(void)file;
return 1;
}

int _lseek(int file, int ptr, int dir)
{
(void)file;
(void)ptr;
(void)dir;
return 0;
}

int _open(char *path, int flags, ...)
{
(void)path;
(void)flags;
/* Pretend like we always fail */
return -1;
}

int _wait(int *status)
{
(void)status;
errno = ECHILD;
return -1;
}

int _unlink(char *name)
{
(void)name;
errno = ENOENT;
return -1;
}

int _times(struct tms *buf)
{
(void)buf;
return -1;
}

int _stat(char *file, struct stat *st)
{
(void)file;
st->st_mode = S_IFCHR;
return 0;
}

int _link(char *old, char *new)
{
(void)old;
(void)new;
errno = EMLINK;
return -1;
}

int _fork(void)
{
errno = EAGAIN;
return -1;
}

int _execve(char *name, char **argv, char **env)
{
(void)name;
(void)argv;
(void)env;
errno = ENOMEM;
return -1;
}
Loading