Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Libcoincellhell
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
Container registry
Model registry
Operate
Environments
Terraform modules
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klemm, Carl Philipp
Libcoincellhell
Commits
1004ecee
Commit
1004ecee
authored
Jun 30, 2023
by
Carl Philipp Klemm
Browse files
Options
Downloads
Patches
Plain Diff
correct spelling of multiplexer
parent
0ec7d189
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/mainpage.txt
+8
-8
8 additions, 8 deletions
doc/mainpage.txt
eismultiplexer.c
+12
-12
12 additions, 12 deletions
eismultiplexer.c
eismultiplexer.h
+18
-18
18 additions, 18 deletions
eismultiplexer.h
main.c
+9
-9
9 additions, 9 deletions
main.c
with
47 additions
and
47 deletions
doc/mainpage.txt
+
8
−
8
View file @
1004ecee
/*! \mainpage lib
relaxisload
er manual
/*! \mainpage lib
eismultiplex
er manual
libeismul
i
tplexer is a shared library that allows you to control
l
EISmul
i
tplexer devices
libeismult
i
plexer is a shared library that allows you to control EISmult
i
plexer devices
An API refer
a
nce can be found here: \subpage API
An API refer
e
nce can be found here: \subpage API
## Example usage:
...
...
@@ -14,11 +14,11 @@ _______
int main(int argc, char* argv[])
{
// Ea
t
ch connection to a device is required to have a corr
i
sponding eismul
i
tplexer struct
struct eismul
i
tplexer multiplexer;
// Each connection to a device is required to have a corr
e
sponding eismult
i
plexer struct
struct eismult
i
plexer multiplexer;
// Connect to the first device found
int ret = eismul
i
tplexer_connect(&multiplexer, 0);
int ret = eismult
i
plexer_connect(&multiplexer, 0);
if(ret != 0)
{
printf("Can not connect to EISmultiplexer device\n");
...
...
@@ -26,7 +26,7 @@ int main(int argc, char* argv[])
}
// Connect channels A and C to the common output
ret = eismul
i
tplexer_connect_channel(&multiplexer, CHANNEL_A | CHANNEL_C);
ret = eismult
i
plexer_connect_channel(&multiplexer, CHANNEL_A | CHANNEL_C);
if(ret != 0)
{
printf("Failure to communicate with the device\n");
...
...
@@ -34,7 +34,7 @@ int main(int argc, char* argv[])
}
// Disconnect from device
eismul
i
tplexer_disconnect(&multiplexer);
eismult
i
plexer_disconnect(&multiplexer);
return 0;
}
@endcode
...
...
This diff is collapsed.
Click to expand it.
eismultiplexer.c
+
12
−
12
View file @
1004ecee
...
...
@@ -32,7 +32,7 @@ static void usleep(uint64_t microseconds)
static
void
dataCallback
(
uint8_t
request
,
unsigned
char
*
data
,
size_t
length
,
void
*
user_data
)
{
struct
eismul
i
tplexer
*
muliplexer
=
user_data
;
struct
eismult
i
plexer
*
muliplexer
=
user_data
;
if
(
length
>=
1
)
muliplexer
->
activeChannels
=
data
[
0
];
...
...
@@ -40,7 +40,7 @@ static void dataCallback(uint8_t request, unsigned char* data, size_t length, vo
sem_post
(
&
muliplexer
->
readSem
);
}
int
eismul
i
tplexer_connect
(
struct
eismul
i
tplexer
*
muliplexer
,
int
serial
)
int
eismult
i
plexer_connect
(
struct
eismult
i
plexer
*
muliplexer
,
int
serial
)
{
int
ret
;
muliplexer
->
priv
=
malloc
(
sizeof
(
*
muliplexer
->
priv
));
...
...
@@ -61,7 +61,7 @@ int eismulitplexer_connect(struct eismulitplexer* muliplexer, int serial)
return
0
;
}
int
eismul
i
tplexer_connect_channel_exclusive
(
struct
eismul
i
tplexer
*
muliplexer
,
channel_t
channel
)
int
eismult
i
plexer_connect_channel_exclusive
(
struct
eismult
i
plexer
*
muliplexer
,
channel_t
channel
)
{
uint16_t
wValue
;
// we compile with fno-strict-aliasing
...
...
@@ -74,21 +74,21 @@ int eismulitplexer_connect_channel_exclusive(struct eismulitplexer* muliplexer,
return
ret
;
}
int
eismul
i
tplexer_connect_channel
(
struct
eismul
i
tplexer
*
muliplexer
,
channel_t
channel
)
int
eismult
i
plexer_connect_channel
(
struct
eismult
i
plexer
*
muliplexer
,
channel_t
channel
)
{
channel_t
channels
=
eismul
i
tplexer_get_connected
(
muliplexer
);
channel_t
channels
=
eismult
i
plexer_get_connected
(
muliplexer
);
channels
|=
channel
;
return
eismul
i
tplexer_connect_channel_exclusive
(
muliplexer
,
channels
);
return
eismult
i
plexer_connect_channel_exclusive
(
muliplexer
,
channels
);
}
int
eismul
i
tplexer_disconnect_channel
(
struct
eismul
i
tplexer
*
muliplexer
,
channel_t
channel
)
int
eismult
i
plexer_disconnect_channel
(
struct
eismult
i
plexer
*
muliplexer
,
channel_t
channel
)
{
channel_t
channels
=
eismul
i
tplexer_get_connected
(
muliplexer
);
channel_t
channels
=
eismult
i
plexer_get_connected
(
muliplexer
);
channels
&=
~
channel
;
return
eismul
i
tplexer_connect_channel_exclusive
(
muliplexer
,
channels
);
return
eismult
i
plexer_connect_channel_exclusive
(
muliplexer
,
channels
);
}
channel_t
eismul
i
tplexer_get_connected
(
struct
eismul
i
tplexer
*
muliplexer
)
channel_t
eismult
i
plexer_get_connected
(
struct
eismult
i
plexer
*
muliplexer
)
{
usbshm_readControlTransfer
(
muliplexer
->
priv
,
3
,
1
);
sem_wait
(
&
muliplexer
->
readSem
);
...
...
@@ -96,7 +96,7 @@ channel_t eismulitplexer_get_connected(struct eismulitplexer* muliplexer)
}
int
eismul
i
tplexer_set_led
(
struct
eismul
i
tplexer
*
muliplexer
,
bool
on
)
int
eismult
i
plexer_set_led
(
struct
eismult
i
plexer
*
muliplexer
,
bool
on
)
{
int
ret
;
while
((
ret
=
usbshm_writeControlTransfer
(
muliplexer
->
priv
,
on
,
NULL
,
0
,
0
,
0
))
==
USBSHM_ERROR_AGAIN
)
...
...
@@ -104,7 +104,7 @@ int eismulitplexer_set_led(struct eismulitplexer* muliplexer, bool on)
return
ret
;
}
void
eismul
i
tplexer_disconnect
(
struct
eismul
i
tplexer
*
muliplexer
)
void
eismult
i
plexer_disconnect
(
struct
eismult
i
plexer
*
muliplexer
)
{
usbshm_distroy
(
muliplexer
->
priv
);
free
(
muliplexer
->
priv
);
...
...
This diff is collapsed.
Click to expand it.
eismultiplexer.h
+
18
−
18
View file @
1004ecee
...
...
@@ -23,9 +23,9 @@
#include
<stdbool.h>
/**
Api to controll EISmul
i
tplexer devices.
Api to controll EISmult
i
plexer devices.
* @defgroup API User API
* This api allows you to controll the EISmul
i
tplexer device.
* This api allows you to controll the EISmult
i
plexer device.
* @{
*/
...
...
@@ -44,64 +44,64 @@ typedef enum {
CHANNEL_NONE
=
0
,
}
channel_t
;
struct
eismul
i
tplexer
{
struct
eismult
i
plexer
{
struct
usbshm
*
priv
;
sem_t
readSem
;
channel_t
activeChannels
;
};
/**
* @brief Attempts to connect to a EISmul
i
tplexer device and initalizes a eismul
i
tplexer struct
* @param muliplexer pointer to a eismul
i
tplexer struct to initalize
* @brief Attempts to connect to a EISmult
i
plexer device and initalizes a eismult
i
plexer struct
* @param muliplexer pointer to a eismult
i
plexer struct to initalize
* @param serial The serial number of the device to connect to, or 0 for any
* @return 0 on sucess and < 0 on failure
*/
int
eismul
i
tplexer_connect
(
struct
eismul
i
tplexer
*
muliplexer
,
int
serial
);
int
eismult
i
plexer_connect
(
struct
eismult
i
plexer
*
muliplexer
,
int
serial
);
/**
* @brief Conects the given channel(s) to the common inputs
* @param muliplexer pointer to a eismul
i
tplexer struct
* @param muliplexer pointer to a eismult
i
plexer struct
* @param channel A channel to connect, multiple channels can be specified by or'ing together the chanel flags e.g. (CHANNEL_A | CHANNEL_B)
* @return 0 on sucess and < 0 on failure
*/
int
eismul
i
tplexer_connect_channel
(
struct
eismul
i
tplexer
*
muliplexer
,
channel_t
channel
);
int
eismult
i
plexer_connect_channel
(
struct
eismult
i
plexer
*
muliplexer
,
channel_t
channel
);
/**
* @brief Conects the given channel(s) to the common inputs disconnecting all others
* @param muliplexer pointer to a eismul
i
tplexer struct
* @param muliplexer pointer to a eismult
i
plexer struct
* @param channel A channel to connect, multiple channels can be specified by or'ing together the chanel flags e.g. (CHANNEL_A | CHANNEL_B)
* @return 0 on sucess and < 0 on failure
*/
int
eismul
i
tplexer_connect_channel_exclusive
(
struct
eismul
i
tplexer
*
muliplexer
,
channel_t
channel
);
int
eismult
i
plexer_connect_channel_exclusive
(
struct
eismult
i
plexer
*
muliplexer
,
channel_t
channel
);
/**
* @brief Disconnect the given channel(s) to the common inputs disconnecting all others
* @param muliplexer pointer to a eismul
i
tplexer struct
* @param muliplexer pointer to a eismult
i
plexer struct
* @param channel A channel to connect, multiple channels can be specified by or'ing together the chanel flags e.g. (CHANNEL_A | CHANNEL_B)
* All channels can be dissconnected by passing CHANNEL_NONE
* @return 0 on sucess and < 0 on failure
*/
int
eismul
i
tplexer_disconnect_channel
(
struct
eismul
i
tplexer
*
muliplexer
,
channel_t
channel
);
int
eismult
i
plexer_disconnect_channel
(
struct
eismult
i
plexer
*
muliplexer
,
channel_t
channel
);
/**
* @brief Returns the channels currently connected
* @param muliplexer pointer to a eismul
i
tplexer struct
* @param muliplexer pointer to a eismult
i
plexer struct
* @return channels connected as a bitfield
*/
channel_t
eismul
i
tplexer_get_connected
(
struct
eismul
i
tplexer
*
muliplexer
);
channel_t
eismult
i
plexer_get_connected
(
struct
eismult
i
plexer
*
muliplexer
);
/**
* @brief Turns the led on the pcb on or off
* @param muliplexer pointer to a eismul
i
tplexer struct
* @param muliplexer pointer to a eismult
i
plexer struct
* @param on true to turn the led on, false to turn it off
* @return 0 on sucess and < 0 on failure
*/
int
eismul
i
tplexer_set_led
(
struct
eismul
i
tplexer
*
muliplexer
,
bool
on
);
int
eismult
i
plexer_set_led
(
struct
eismult
i
plexer
*
muliplexer
,
bool
on
);
/**
* @brief Disconnects from the eismul
i
tplexer
* @brief Disconnects from the eismult
i
plexer
*/
void
eismul
i
tplexer_disconnect
(
struct
eismul
i
tplexer
*
muliplexer
);
void
eismult
i
plexer_disconnect
(
struct
eismult
i
plexer
*
muliplexer
);
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
main.c
+
9
−
9
View file @
1004ecee
...
...
@@ -74,9 +74,9 @@ int main(int argc, char* argv[])
return
0
;
}
struct
eismul
i
tplexer
multiplexer
;
struct
eismult
i
plexer
multiplexer
;
if
(
eismul
i
tplexer_connect
(
&
multiplexer
,
0
))
if
(
eismult
i
plexer_connect
(
&
multiplexer
,
0
))
{
printf
(
"Can not connect to EISmultiplexer device
\n
"
);
return
1
;
...
...
@@ -85,7 +85,7 @@ int main(int argc, char* argv[])
if
(
argc
!=
4
)
{
print_help
(
argv
[
0
]);
eismul
i
tplexer_disconnect
(
&
multiplexer
);
eismult
i
plexer_disconnect
(
&
multiplexer
);
return
2
;
}
...
...
@@ -93,29 +93,29 @@ int main(int argc, char* argv[])
if
(
channel
==
CHANNEL_NONE
)
{
printf
(
"%c is not a valid channel"
,
argv
[
2
][
0
]);
eismul
i
tplexer_disconnect
(
&
multiplexer
);
eismult
i
plexer_disconnect
(
&
multiplexer
);
return
2
;
}
if
(
strcmp
(
argv
[
1
],
"connect"
)
==
0
)
{
if
(
eismul
i
tplexer_connect_channel
(
&
multiplexer
,
channel
))
if
(
eismult
i
plexer_connect_channel
(
&
multiplexer
,
channel
))
{
printf
(
"could not connect channel %c"
,
argv
[
2
][
0
]);
eismul
i
tplexer_disconnect
(
&
multiplexer
);
eismult
i
plexer_disconnect
(
&
multiplexer
);
return
3
;
}
}
else
if
(
strcmp
(
argv
[
1
],
"disconnect"
)
==
0
)
{
if
(
eismul
i
tplexer_disconnect_channel
(
&
multiplexer
,
channel
))
if
(
eismult
i
plexer_disconnect_channel
(
&
multiplexer
,
channel
))
{
printf
(
"could not connect channel %c"
,
argv
[
2
][
0
]);
eismul
i
tplexer_disconnect
(
&
multiplexer
);
eismult
i
plexer_disconnect
(
&
multiplexer
);
return
3
;
}
}
eismul
i
tplexer_disconnect
(
&
multiplexer
);
eismult
i
plexer_disconnect
(
&
multiplexer
);
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