[Armadeus-commitlog] armadeus branch, master, updated. release-3.4-289-g137cfdb
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2011-07-05 09:26:20
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 137cfdb41bde206268294055b15883222a2dc964 (commit)
from aa6f42268cdf2cf7410a881e905f36d50dd36bb5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 137cfdb41bde206268294055b15883222a2dc964
Author: Fabien Marteau <fab...@ar...>
Date: Tue Jul 5 11:25:45 2011 +0200
[demo] adding can device name in parameters
-----------------------------------------------------------------------
Summary of changes:
target/demos/mcp25020_ctrl/mcp25020_ctrl.c | 31 +++++++++++----------------
1 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/target/demos/mcp25020_ctrl/mcp25020_ctrl.c b/target/demos/mcp25020_ctrl/mcp25020_ctrl.c
index e4c3bdd..d9b77c2 100644
--- a/target/demos/mcp25020_ctrl/mcp25020_ctrl.c
+++ b/target/demos/mcp25020_ctrl/mcp25020_ctrl.c
@@ -67,13 +67,13 @@ int main(int argc, char **argv)
signal(SIGINT, int_quit); /* Capture the ctrl+C sequence */
/* If no arguments is given */
- if (argc < 2) {
+ if (argc < 3) {
display_help();
return EXIT_SUCCESS;
}
/* Interface selection on can0 */
- strcpy(ifr.ifr_name, "can0");
+ strcpy(ifr.ifr_name, argv[1]);
/* Socket creation */
if ((can_socket = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0 ) {
@@ -94,40 +94,40 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- if (strcmp(argv[1], "listen") == 0) {
+ if (strcmp(argv[2], "listen") == 0) {
listen_mode(can_socket);/* Entering in listen mode */
- } else if(strcmp(argv[1], "led-blink") == 0) {
+ } else if(strcmp(argv[2], "led-blink") == 0) {
if (argc < 3) {
printf("led-blink : Please specify the blinking interval in ms (1 to 10000)\n");
return EXIT_SUCCESS;
}
- if ((atoi(argv[2]) < 1) || (atoi(argv[2]) > 10000)) {
+ if ((atoi(argv[3]) < 1) || (atoi(argv[3]) > 10000)) {
printf("led-blink : Please specify the blinking interval in ms (1 to 10000)\n");
return EXIT_SUCCESS;
}
- led_blink(can_socket, atoi(argv[2]));/* Entering in led blinking mode */
- } else if(strcmp(argv[1], "led-state") == 0) {
+ led_blink(can_socket, atoi(argv[3]));/* Entering in led blinking mode */
+ } else if(strcmp(argv[2], "led-state") == 0) {
if (argc < 3) {
printf("led-state : Please specify ON or OFF\n");
return EXIT_SUCCESS;
}
- if (strcmp(argv[2], "ON") == 0) {
+ if (strcmp(argv[3], "ON") == 0) {
set_led_state(can_socket, LED_ON);
- } else if (strcmp(argv[2], "OFF") == 0) {
+ } else if (strcmp(argv[3], "OFF") == 0) {
set_led_state(can_socket, LED_OFF);
} else {
printf("led-state : Please specify ON or OFF\n");
return EXIT_SUCCESS;
}
- } else if(strcmp(argv[1], "sw2-get") == 0) {
+ } else if(strcmp(argv[2], "sw2-get") == 0) {
sw2_get(can_socket);/* Entering in get state of the SW2 switch mode */
- } else if(strcmp(argv[1], "config") == 0) {
+ } else if(strcmp(argv[2], "config") == 0) {
read_config(can_socket);
} else {
display_help();/* Display display_help */
@@ -289,14 +289,9 @@ void read_config(int can_socket)
void display_help()
{/* Display display_help */
- printf("#################################\n");
- printf("# #\n");
- printf("# Armadeus Systems #\n");
- printf("# Demo can_mcp25020 #\n");
- printf("# #\n");
- printf("#################################\n\n");
+ printf("Armadeus Systems - Demo can_mcp25020\n");
printf("This sofware is a demonstration. It show how to communicate with a MICROCHIP MCP25020 using the can bus with socketCAN\n\n");
- printf("USE: can_mcp25020 [TEST]\nTEST are:\n");
+ printf("USE: can_mcp25020 <can_dev> [TEST]\nTEST are:\n");
printf("\tlisten : Listen on the can bus\n");
printf("\tled-blink [INTERVAL]: blink the D6 led. You must specify the blinking interval in ms (1 to 10000 ms)\n");
printf("\tled-state [ON | OFF]: turn the D6 led on the specified state (ON or OFF)\n");
hooks/post-receive
--
armadeus
|