Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
White Rabbit Switch - Software
Manage
Activity
Members
Labels
Plan
Issues
87
Issue boards
Milestones
Wiki
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
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
Projects
White Rabbit Switch - Software
Commits
bec4be9a
Commit
bec4be9a
authored
12 years ago
by
Benoit Rat
Browse files
Options
Downloads
Patches
Plain Diff
libswitchhw: update pca9554 i2c functions
parent
5c48e158
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
userspace/libswitchhw/libshw_i2c.c
+2
-4
2 additions, 4 deletions
userspace/libswitchhw/libshw_i2c.c
userspace/libswitchhw/libshw_i2c.h
+3
-1
3 additions, 1 deletion
userspace/libswitchhw/libshw_i2c.h
with
5 additions
and
5 deletions
userspace/libswitchhw/libshw_i2c.c
+
2
−
4
View file @
bec4be9a
#include
"libshw_i2c.h"
int
wrswhw_pca9554_configure
(
struct
i2c_bus
*
bus
,
uint32_t
address
)
int
wrswhw_pca9554_configure
(
struct
i2c_bus
*
bus
,
uint32_t
address
,
uint8_t
value
)
{
//config initial port dir
uint8_t
config_outputs
[
2
]
=
{
PCA9554_CMD_DIR_REG
,
WRSWHW_OUTPUT_BITMAP
};
uint8_t
config_outputs
[
2
]
=
{
PCA9554_CMD_DIR_REG
,
value
};
int
result
=
i2c_transfer
(
bus
,
address
,
sizeof
(
config_outputs
),
0
,
config_outputs
);
if
(
result
<
0
)
return
result
;
return
wrswhw_pca9554_set_output_reg
(
bus
,
address
,
WRSWHW_INITIAL_OUTPUT_STATE
);
}
...
...
This diff is collapsed.
Click to expand it.
userspace/libswitchhw/libshw_i2c.h
+
3
−
1
View file @
bec4be9a
...
...
@@ -20,12 +20,14 @@
#define PCA9554_CMD_POLARITY_REG 2
#define PCA9554_CMD_DIR_REG 3
#define I2C_CHIP_PCA9554 1
//output bitmap for each expander (all out)
#define WRSWHW_OUTPUT_BITMAP 0
//initial state for outputs
#define WRSWHW_INITIAL_OUTPUT_STATE (LINK1_SFP_TX_DISABLE | LINK0_SFP_TX_DISABLE)
int
wrswhw_pca9554_configure
(
struct
i2c_bus
*
bus
,
uint32_t
address
);
int
wrswhw_pca9554_configure
(
struct
i2c_bus
*
bus
,
uint32_t
address
,
uint8_t
value
);
int
wrswhw_pca9554_set_output_reg
(
struct
i2c_bus
*
bus
,
uint32_t
address
,
uint8_t
value
);
int
wrswhw_pca9554_get_input
(
struct
i2c_bus
*
bus
,
uint32_t
address
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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