Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
derf
multipass
Commits
f6972a43
Commit
f6972a43
authored
6 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
configurable i2c bitrate on arduino nano
parent
7343085d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/i2cbench/main.cc
+3
-2
3 additions, 2 deletions
src/app/i2cbench/main.cc
src/arch/arduino-nano/Makefile.inc
+4
-0
4 additions, 0 deletions
src/arch/arduino-nano/Makefile.inc
src/arch/arduino-nano/driver/i2c.cc
+5
-1
5 additions, 1 deletion
src/arch/arduino-nano/driver/i2c.cc
with
12 additions
and
3 deletions
src/app/i2cbench/main.cc
+
3
−
2
View file @
f6972a43
...
...
@@ -25,8 +25,9 @@
void
loop
(
void
)
{
#ifdef DRIVER_LM75
kout
.
printf_float
(
lm75
.
getTemp
());
kout
<<
endl
;
//kout.printf_float(lm75.getTemp());
//kout << endl;
lm75
.
setOS
(
64
);
#endif
#ifdef DRIVER_AM2320
am2320
.
read
();
...
...
This diff is collapsed.
Click to expand it.
src/arch/arduino-nano/Makefile.inc
+
4
−
0
View file @
f6972a43
...
...
@@ -32,6 +32,10 @@ ifneq ($(findstring stdin,${arch_drivers}), )
TARGETS
+=
src/arch/arduino-nano/driver/stdin.cc
endif
ifneq
(${i2c_freq}, )
COMMON_FLAGS
+=
-DF_I2C
=
${
i2c_freq
}
endif
OBJECTS
=
${
TARGETS:.cc
=
.o
}
.cc.o
:
...
...
This diff is collapsed.
Click to expand it.
src/arch/arduino-nano/driver/i2c.cc
+
5
−
1
View file @
f6972a43
...
...
@@ -3,6 +3,10 @@
#include
<avr/io.h>
#include
<avr/interrupt.h>
#ifndef F_I2C
#define F_I2C 100000UL
#endif
inline
void
await_twint
(
unsigned
char
twcr_values
)
{
TWCR
=
twcr_values
|
_BV
(
TWINT
)
|
_BV
(
TWIE
);
...
...
@@ -99,7 +103,7 @@ static signed char i2c_receive(uint8_t len, uint8_t *data)
signed
char
I2C
::
setup
()
{
TWSR
=
0
;
TWBR
=
((
F_CPU
/
100000UL
)
-
16
)
/
2
;
TWBR
=
((
F_CPU
/
F_I2C
)
-
16
)
/
2
;
return
0
;
}
...
...
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