Skip to content

Commit

Permalink
Added GPS task
Browse files Browse the repository at this point in the history
  • Loading branch information
APBashara committed Sep 15, 2024
1 parent 36baf9b commit 7eb5185
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const osThreadAttr_t CANTask_attr = {
.stack_size = 128 * 4
};

osThreadId_t GPSTask;
const osThreadAttr_t GPSTask_attr = {
.name = "GPS_Task",
.priority = osPriorityNormal,
.stack_size = 128 * 4
};

void main() {
osKernelInitialize(); // Initialize FreeRTOS

Expand All @@ -40,6 +47,7 @@ void main() {
// Create FreeRTOS Threads
StatusLED = osThreadNew(Status_LED, NULL, &StatusLED_attr);
CANTask = osThreadNew(CAN_Task, NULL, &CANTask_attr);
GPSTask = osThreadNew(GPS_Task, NULL, &GPSTask_attr);

osKernelStart(); // Start FreeRTOS
while(1);
Expand Down Expand Up @@ -71,4 +79,14 @@ void CAN_Task() {
}
osDelay(1000);
}
}

void GPS_Task() {
volatile uint8_t data;
volatile uint16_t lat, lon;

while(1) {
data = I2C_Read(I2C1, GPS_ADDR, 0xFF);
osDelay(1000);
}
}

0 comments on commit 7eb5185

Please sign in to comment.