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
Wiki
External 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Astro
firmware
Commits
97114129
Commit
97114129
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(helloworld): Also scan 7 bit i2c bus
parent
0c0ddc14
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
Hello_World/main.c
+9
-4
9 additions, 4 deletions
Hello_World/main.c
with
9 additions
and
4 deletions
Hello_World/main.c
+
9
−
4
View file @
97114129
...
...
@@ -103,8 +103,8 @@ int main(void)
printf
(
"Hello World!
\n
"
);
//Setup the I2CM
I2C_Shutdown
(
I2C_DEVICE
);
I2C_Init
(
I2C_DEVICE
,
I2C_FAST_MODE
,
NULL
);
I2C_Shutdown
(
MXC_I2C0_BUS0
);
I2C_Init
(
MXC_I2C0_BUS0
,
I2C_FAST_MODE
,
NULL
);
I2C_Shutdown
(
MXC_I2C1_BUS0
);
I2C_Init
(
MXC_I2C1_BUS0
,
I2C_FAST_MODE
,
NULL
);
...
...
@@ -117,9 +117,14 @@ int main(void)
// "7-bit addresses 0b0000xxx and 0b1111xxx are reserved"
for
(
int
addr
=
0x8
;
addr
<
0x78
;
++
addr
)
{
// A 0 byte write does not seem to work so always send a single byte.
int
res
=
I2C_MasterWrite
(
I2C_DEVICE
,
addr
<<
1
,
dummy
,
1
,
0
);
int
res
=
I2C_MasterWrite
(
MXC_I2C0_BUS0
,
addr
<<
1
,
dummy
,
1
,
0
);
if
(
res
==
1
)
{
printf
(
"Found (7 bit) address 0x%02x
\n
"
,
addr
);
printf
(
"Found (7 bit) address 0x%02x on I2C0
\n
"
,
addr
);
}
res
=
I2C_MasterWrite
(
MXC_I2C1_BUS0
,
addr
<<
1
,
dummy
,
1
,
0
);
if
(
res
==
1
)
{
printf
(
"Found (7 bit) address 0x%02x on I2C1
\n
"
,
addr
);
}
}
...
...
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