Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Merge requests
!64
Cleanup Epicardium API and Serial Module
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Cleanup Epicardium API and Serial Module
rahix/api-cleanup
into
master
Overview
1
Commits
5
Pipelines
3
Changes
6
Merged
rahix
requested to merge
rahix/api-cleanup
into
master
5 years ago
Overview
1
Commits
5
Pipelines
3
Changes
6
Expand
0
0
Merge request reports
Compare
master
version 2
b6cd9906
5 years ago
version 1
b9aff4a3
5 years ago
master (base)
and
latest version
latest version
b7e210c9
5 commits,
5 years ago
version 2
b6cd9906
5 commits,
5 years ago
version 1
b9aff4a3
4 commits,
5 years ago
6 files
+
183
−
96
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
epicardium/modules/serial.c
+
30
−
14
Options
#include
<stdint.h>
#include
<stdio.h>
#include
"epicardium.h"
#include
"api/interrupt-sender.h"
#include
"modules/log.h"
#include
"modules/modules.h"
#include
"max32665.h"
#include
"cdcacm.h"
@@ -9,9 +11,8 @@
#include
"task.h"
#include
"queue.h"
#include
"modules.h"
#include
"modules/log.h"
#include
"api/interrupt-sender.h"
#include
<stdint.h>
#include
<stdio.h>
/* Task ID for the serial handler */
TaskHandle_t
serial_task_id
=
NULL
;
@@ -31,13 +32,31 @@ void epic_uart_write_str(const char *str, intptr_t length)
}
/*
*
Blocking
API-call to read a character from the queue.
* API-call to read a character from the queue.
*/
char
epic_uart_read_chr
(
void
)
int
epic_uart_read_ch
a
r
(
void
)
{
char
chr
;
xQueueReceive
(
read_queue
,
&
chr
,
portMAX_DELAY
);
return
chr
;
if
(
xQueueReceive
(
read_queue
,
&
chr
,
0
)
==
pdTRUE
)
{
return
(
int
)
chr
;
}
return
(
-
1
);
}
/*
* API-call to read data from the queue.
*/
int
epic_uart_read_str
(
char
*
buf
,
size_t
cnt
)
{
int
i
=
0
;
for
(
i
=
0
;
i
<
cnt
;
i
++
)
{
if
(
xQueueReceive
(
read_queue
,
&
buf
[
i
],
0
)
!=
pdTRUE
)
{
break
;
}
}
return
i
;
}
/* Interrupt handler needed for SDK UART implementation */
@@ -60,15 +79,12 @@ static void enqueue_char(char chr)
api_interrupt_trigger
(
EPIC_INT_CTRL_C
);
}
if
(
chr
==
0x0e
)
{
/* Control-N */
api_interrupt_trigger
(
EPIC_INT_BHI160_TEST
);
}
if
(
xQueueSend
(
read_queue
,
&
chr
,
100
)
==
errQUEUE_FULL
)
{
/* Queue overran, wait a bit */
vTaskDelay
(
portTICK_PERIOD_MS
*
50
);
}
api_interrupt_trigger
(
EPIC_INT_UART_RX
);
}
void
vSerialTask
(
void
*
pvParameters
)
Loading