Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ieee802154-radio-eval
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
cm-projects
ieee802154-radio-eval
Commits
df39cdd3
Commit
df39cdd3
authored
6 years ago
by
Robert Hartung
Browse files
Options
Downloads
Patches
Plain Diff
adds temperature sensor tmp102 to software
parent
c1a8ccee
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
software/main.c
+32
-3
32 additions, 3 deletions
software/main.c
with
32 additions
and
3 deletions
software/main.c
+
32
−
3
View file @
df39cdd3
...
...
@@ -33,6 +33,7 @@
#include
"net/gnrc.h"
#include
"net/gnrc/netreg.h"
#include
"net/gnrc/netif/ieee802154.h"
#include
"periph/i2c.h"
#define SEND_INTERVAL (1)
#define RCV_QUEUE_SIZE (8)
...
...
@@ -107,6 +108,7 @@ int shell_payload(int argc, char** argv) {
}
else
{
strcpy
((
char
*
)
eval_message
.
payload
,
argv
[
1
]);
eval_message
.
payload_length
=
strlen
(
argv
[
1
]);
//eval_message.payload_length = strncpy( (char*)eval_message.payload, argv[1], MAX_PAYLOAD_LENGTH);
}
return
0
;
}
...
...
@@ -119,9 +121,9 @@ int shell_memdump(int argc, char** argv) {
const
uint8_t
*
addr
=
(
const
uint8_t
*
)
0x1800
;
while
(
addr
<
(
const
uint8_t
*
)
0x2600
)
{
uint8_t
i
=
0
;
printf
(
"%04X: "
,
addr
);
printf
(
"%04X: "
,
(
unsigned
int
)
addr
);
while
(
i
<
0xF
)
{
printf
(
"%02X "
,
*
(
addr
+
i
));
printf
(
"%02X "
,
(
unsigned
int
)(
*
(
addr
+
i
))
)
;
i
++
;
}
i
=
0
;
...
...
@@ -137,10 +139,34 @@ int shell_memdump(int argc, char** argv) {
return
0
;
}
#ifdef BOARD_INGA_BLUE
int
shell_temp
(
int
argc
,
char
**
argv
)
{
(
void
)
argc
;
(
void
)
argv
;
// uint8_t result;
uint8_t
result
[
2
];
i2c_acquire
(
0
);
//i2c_read_reg(0, 0x48, 0x00, &result);
i2c_read_regs
(
0
,
0x48
,
0x00
,
result
,
2
);
i2c_release
(
0
);
//uint16_t temp = (result[0] << 8) | (result[1] >> 4);
//printf("temperature is %d %d\n", result[0], result[1]);
//printf("temperature=%u\n", temp);
printf
(
"temperature=%u.%d
\n
"
,
result
[
0
],
(
result
[
1
]
>>
4
)
);
return
0
;
}
#endif
shell_command_t
eval_shell_commands
[]
=
{
{
"tx"
,
"Sends packets"
,
shell_tx
},
{
"payload"
,
"Sets or prints the payload"
,
shell_payload
},
{
"memdump"
,
"Prints the memory"
,
shell_memdump
},
#ifdef BOARD_INGA_BLUE
{
"temp"
,
"Read temperatur"
,
shell_temp
},
#endif
{
NULL
,
NULL
,
NULL
}
};
...
...
@@ -485,6 +511,9 @@ int main(void)
{
/// +1 -> INGA working, but TelosB/Sky not
thread_create
(
dump_thread_stack
,
sizeof
(
dump_thread_stack
),
THREAD_PRIORITY_MAIN
+
1
,
THREAD_CREATE_STACKTEST
,
dump_thread
,
NULL
,
"dump_thread"
);
int
res
=
i2c_init_master
(
I2C_DEV
(
0
),
2
);
printf
(
"i2c init: %s
\n
"
,
res
==
0
?
"OK
\n
"
:
"FAILED
\n
"
);
gnrc_netif_t
*
netif
=
NULL
;
if
((
netif
=
gnrc_netif_iter
(
netif
)))
{
...
...
@@ -507,4 +536,4 @@ int main(void)
shell_run
(
eval_shell_commands
,
line_buf
,
SHELL_BUFFER_SIZE
);
return
0
;
}
\ No newline at end of file
}
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