Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICRE - ESP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ricardo Andres Ercoli Auersperg
ICRE - ESP
Commits
fc7ab6b1
Commit
fc7ab6b1
authored
2 years ago
by
Ricardo Andres Ercoli Auersperg
Browse files
Options
Downloads
Patches
Plain Diff
Send and receive one float via UART
parent
699c19d2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Robotito/include/control.h
+1
-0
1 addition, 0 deletions
Robotito/include/control.h
Robotito/src/control/control.c
+6
-7
6 additions, 7 deletions
Robotito/src/control/control.c
Robotito/src/main.c
+1
-2
1 addition, 2 deletions
Robotito/src/main.c
with
8 additions
and
9 deletions
Robotito/include/control.h
+
1
−
0
View file @
fc7ab6b1
...
...
@@ -87,6 +87,7 @@ typedef struct {
static
servo_t
motors
[
NMOTORS
];
static
odom_t
odometry
;
static
float
float_buffer
[
6
];
esp_err_t
omni_init
();
...
...
This diff is collapsed.
Click to expand it.
Robotito/src/control/control.c
+
6
−
7
View file @
fc7ab6b1
...
...
@@ -121,20 +121,19 @@ static void callback_odometry(){
//char* Txdata = (char*) malloc(100);
//sprintf (Txdata, "Hello world index \r\n");
//uart_write_bytes(UART_NUM_2, Txdata, strlen(Txdata));
float
float_buffer
[
6
];
//float_buffer = o;
float_buffer
[
0
]
=
o
->
x
;
float_buffer
[
0
]
=
PI
;
float_buffer
[
1
]
=
o
->
x_dot
;
float_buffer
[
2
]
=
o
->
y
;
float_buffer
[
3
]
=
o
->
y_dot
;
float_buffer
[
4
]
=
o
->
phi
;
float_buffer
[
5
]
=
o
->
phi_dot
;
uart_write_bytes
(
UART_NUM_2
,
&
float_buffer
[
0
],
sizeof
(
float
));
uart_write_bytes
(
UART_NUM_2
,
&
float_buffer
[
1
],
sizeof
(
float
));
uart_write_bytes
(
UART_NUM_2
,
&
float_buffer
[
2
],
sizeof
(
float
));
uart_write_bytes
(
UART_NUM_2
,
&
float_buffer
[
3
],
sizeof
(
float
));
uart_write_bytes
(
UART_NUM_2
,
&
float_buffer
[
4
],
sizeof
(
float
));
uart_write_bytes
(
UART_NUM_2
,
&
float_buffer
[
5
],
sizeof
(
float
));
//
uart_write_bytes(UART_NUM_2, &float_buffer[1], sizeof(float));
//
uart_write_bytes(UART_NUM_2, &float_buffer[2], sizeof(float));
//
uart_write_bytes(UART_NUM_2, &float_buffer[3], sizeof(float));
//
uart_write_bytes(UART_NUM_2, &float_buffer[4], sizeof(float));
//
uart_write_bytes(UART_NUM_2, &float_buffer[5], sizeof(float));
free
(
v
);
}
...
...
This diff is collapsed.
Click to expand it.
Robotito/src/main.c
+
1
−
2
View file @
fc7ab6b1
...
...
@@ -50,7 +50,6 @@ static void uart_task(void *pvParameters)
len
=
uart_read_bytes
(
UART_NUM
,
data
,
BUF_SIZE
,
portMAX_DELAY
);
if
(
len
==
BUF_SIZE
){
memcpy
(
&
fdata
,
data
,
sizeof
(
fdata
));
printf
(
"%s
\n
"
,
data
);
for
(
int
i
=
0
;
i
<
FLOAT_BUF_SIZE
;
i
++
)
{
printf
(
"El dato %d en float es: %f
\n
"
,
i
,
fdata
[
i
]);
...
...
@@ -83,7 +82,7 @@ static void init_uart(void)
uart_set_pin
(
UART_NUM
,
5
,
4
,
UART_PIN_NO_CHANGE
,
UART_PIN_NO_CHANGE
);
uart_driver_install
(
UART_NUM
,
BUF_SIZE
*
2
,
BUF_SIZE
*
2
,
5
,
&
uart_queue
,
0
);
uart_driver_install
(
UART_NUM
,
1024
,
1024
,
5
,
&
uart_queue
,
0
);
xTaskCreate
(
uart_task
,
"uart_task"
,
TASK_MEMORY
,
NULL
,
5
,
NULL
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment