Commit Graph

49 Commits

Author SHA1 Message Date
eeeck ac5d9f6a72 Set CAN event flag and LED thread flag in ISR
- This is efficient specifically for
  STM32F4x with Thumb-2 IT block
  optimization enabled (-02 or -03)
2026-06-16 19:11:38 +02:00
eeeck 76628dec90 Initialize UART task and semaphore and CAN event flags 2026-06-16 19:10:53 +02:00
eeeck f260dfe972 Use define instead of hardcoded value 2026-06-16 18:11:12 +02:00
eeeck 12ef44d3d8 Use clearer variable name 2026-06-16 18:06:26 +02:00
eeeck 34df5e51b7 Remove LED contexts
- Are now unnecessary with the move to task notification
2026-06-16 17:59:57 +02:00
eeeck 266efdfa7c Fix spacing 2026-06-16 17:57:42 +02:00
eeeck 7d40531250 Return instead of critical error
- To find a way to handle overflows on the FIFO buffer
2026-06-16 17:57:35 +02:00
eeeck 6446f5209b Remove semaphores in favor of task notifications
- Less overhead, simpler to manage
- Semaphores are apparently overkill for a simple blink timer
2026-06-16 17:56:11 +02:00
eeeck 2c14d095f7 Better way to avoid race condition, only notification lives in CAN task
- Runs only once
- Only critical notification is inside task
- CAN message during boot will not be lost, instead put inside FIFO0
2026-06-15 14:30:35 +02:00
eeeck 975acb8c3e Indentation fixes 2026-06-15 14:27:05 +02:00
eeeck b1744ce941 Fix double semaphore release 2026-06-15 14:17:12 +02:00
eeeck 8c8fe93d5b Release CANrx semaphore in ISR 2026-06-15 14:09:51 +02:00
eeeck ab8b68313b Transition from timer based to task based LED signal
- Remove RTOS timers
- Create LED task
- Avoid polling, instead wait for semaphore
2026-06-15 14:06:51 +02:00
eeeck ac212c4a0a Merge pull request 'Change headers with better copyright comments' (#13)
from code-licensing into j1939

Reviewed-on: erickahmed/j1939_logger#13
2026-06-14 21:36:45 +02:00
eeeck 3c66a39a5d Fix variable name mismatch 2026-06-14 21:27:10 +02:00
eeeck 17febf569a Use a more generic name as semaphore will be used by other tasks 2026-06-14 18:31:54 +02:00
eeeck 53772ccb7d Remove error handling as it would cause crash on full queue 2026-06-14 16:45:02 +02:00
eeeck 75efc4840d Use new context structure instead of direct pass 2026-06-14 15:17:03 +02:00
eeeck a75d42faeb Create context structure for timer callback
Strucure is made of
-  LED (port, pin)
- Semaphore
- Timer handle
2026-06-14 15:16:23 +02:00
eeeck 5b500d72ff Avoid having to declare additional variable 2026-06-14 14:56:32 +02:00
eeeck de6dc24dd3 Acquire semaphore and restart timer if new message incoming 2026-06-14 14:51:33 +02:00
eeeck 1b38c0f29a Release semaphore on incoming message
- Discard previous solution with timer only
2026-06-14 14:50:49 +02:00
eeeck ebbd1816fa Write LOW status on LED when timer triggers 2026-06-14 14:19:44 +02:00
eeeck 2e2150ebd2 Write HIGH status on LED on incoming CAN message and start 25ms timer 2026-06-14 14:19:30 +02:00
eeeck d6ea04e33e Change variable name 2026-06-14 14:18:40 +02:00
eeeck d42e5fce46 Read CAN messages from FIFO buffer 2026-06-14 13:55:05 +02:00
eeeck 8ef0980510 Handle ISR for CANrx by saving message in FIFO buffer 2026-06-14 13:53:40 +02:00
eeeck 19eaee2674 Enable interrupt when CAN frame received and stored in FIFO buffer 2026-06-14 10:42:26 +02:00
eeeck 8e37c44eae Refactor naming conventions following FREERTOS guidelines 2026-06-14 10:04:16 +02:00
eeeck c101c77ba4 Refactor: move RTOS task definition back to main.c
- Private functions remain on canlog.c
- Better consistency for when regenerating with CubeMX
2026-06-14 00:36:41 +02:00
eeeck 0e4b41647f Change headers with better copyright comments
- Add SPDX License Identifier and copyright notice
- Add NOTICE.md

Minor: remove unused freertos.c
2026-06-13 20:07:32 +02:00
eeeck 59a58d1f1f Implement LED heartbeat with RTOS timers instead of threads
- Less memory overhead (no stack allocation)
- Better timing accuracy (less jitter)
- CAN bus still has higher priority than timers
2026-06-10 14:14:17 +02:00
eeeck b38d4d5403 Remove static declare 2026-06-10 13:07:24 +02:00
eeeck 0f6011d05b Use CMSIS-RTOS2 instead of FreeRTOS for consistency 2026-06-10 11:38:30 +02:00
eeeck 6c4a1368be Use more clear names for RTOS function prototypes 2026-06-10 11:28:42 +02:00
eeeck e2b6d13364 Clarify function prototype description 2026-06-10 11:25:31 +02:00
eeeck b14cdfaccb Lower priority for LED heartbeat 2026-06-10 11:25:01 +02:00
eeeck 7bb401762a Add headers for better code regeneration compatibility with STM32CubeMX 2026-06-10 11:24:43 +02:00
eeeck 91385d00cf Configure filter banks and start CAN 2026-06-09 10:42:40 +02:00
eeeck 30b7538e26 Use HAL WritePin func instead of TogglePin
- Better reliability in blinking LED
- Slightly more efficiency (fewer CPU clocks)
2026-06-09 10:05:25 +02:00
eeeck c891681b94 Minor comment clarifications 2026-06-09 09:51:10 +02:00
eeeck 5d3c8c0ec0 Refactor task function name 2026-06-09 09:12:11 +02:00
eeeck c274be6907 Minor clarification on existing comment 2026-06-09 00:27:17 +02:00
eeeck bbdb278338 Minor changes on comments
- Clarifications on existing comments
- Add TODO
2026-06-09 00:17:06 +02:00
eeeck a236377784 Add simple GPIO toggling in RT 2026-06-09 00:08:24 +02:00
eeeck 29284ceb87 Move thread handles and attributes to related file
- Better separation of concerns
2026-06-08 23:38:38 +02:00
eeeck 13de1b6c47 Initialize CAN related tasks for logging and signaling
Initialize tasks for:
- CAN log incoming frames
- CAN blink on CANrx
2026-06-08 23:18:00 +02:00
eeeck 3c6e44821c Add extern declaration for CAN handles 2026-06-03 23:59:21 +02:00
eeeck 74cc33d0a9 Move CAN bus related tasks and definition to canlog.h 2026-06-03 23:34:10 +02:00