Tables and proper doxygen comments
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
123
main.c
123
main.c
@ -1,42 +1,45 @@
|
|||||||
/**
|
/**
|
||||||
ledcontroller-3bit
|
* @file main.c
|
||||||
|
* ledcontroller-3bit
|
||||||
This file is a fork of the LedController code. You will find
|
*
|
||||||
the original copyright notice below.
|
* This file is a fork of the LedController code. You will find
|
||||||
|
* the original copyright notice below.
|
||||||
Copyright (C) 2013 andmarios - http://www.andmarios.com
|
*
|
||||||
|
* @copyright
|
||||||
This program is free software: you can redistribute it and/or modify
|
* Copyright (C) 2013 andmarios - http://www.andmarios.com
|
||||||
it under the terms of the GNU General Public License as published by
|
*
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
* This program is free software: you can redistribute it and/or modify
|
||||||
(at your option) any later version.
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
This program is distributed in the hope that it will be useful,
|
* (at your option) any later version.
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* This program is distributed in the hope that it will be useful,
|
||||||
GNU General Public License for more details.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
You should have received a copy of the GNU General Public License
|
* GNU General Public License for more details.
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Original Copyright Notice:
|
*
|
||||||
|
*
|
||||||
LedController
|
* @copyright
|
||||||
Copyright (C) 2011 jmrobles - http://robleshermoso.wordpress.com
|
* Original Copyright Notice:
|
||||||
|
*
|
||||||
This program is free software: you can redistribute it and/or modify
|
* LedController
|
||||||
it under the terms of the GNU General Public License as published by
|
* Copyright (C) 2011 jmrobles - http://robleshermoso.wordpress.com
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
This program is distributed in the hope that it will be useful,
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* (at your option) any later version.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
GNU General Public License for more details.
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
You should have received a copy of the GNU General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -44,29 +47,33 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define VID 0x1294
|
#define VID 0x1294 /**< USB Vendor ID */
|
||||||
#define PID 0x1320
|
#define PID 0x1320 /**< USB Product ID */
|
||||||
|
|
||||||
static struct libusb_device_handle *devh = NULL;
|
static struct libusb_device_handle *devh = NULL;
|
||||||
/**
|
/**
|
||||||
The device has a RGB LED, which has two states for each "sub-LED",
|
* The device has a RGB LED, which has two states for each "sub-LED",
|
||||||
on and off.
|
* on and off.
|
||||||
The "sub-LEDs" are red, green and blue.
|
* The "sub-LEDs" are red, green and blue.
|
||||||
|
*
|
||||||
Obviously there are 8 possible combinations for their state.
|
* Obviously there are 8 possible combinations for their state.
|
||||||
It seems there aren't bits mapped to each sub-LED, but instead
|
* It seems there aren't bits mapped to each sub-LED, but instead
|
||||||
3-bit values mapped to the 8 combinations.
|
* 3-bit values mapped to the 8 combinations.
|
||||||
|
*
|
||||||
R G B Color Value
|
* | R | G | B | Color | Value | Comment |
|
||||||
0 0 0 off 0x0
|
* | - | - | - | ------ | ----- | ------------------------------- |
|
||||||
0 0 1 blue 0x1
|
* | 0 | 0 | 0 | off | 0x0 | |
|
||||||
1 0 0 red 0x2
|
* | 0 | 0 | 1 | blue | 0x1 | |
|
||||||
0 1 0 green 0x3
|
* | 1 | 0 | 0 | red | 0x2 | |
|
||||||
0 1 1 aqua 0x4
|
* | 0 | 1 | 0 | green | 0x3 | |
|
||||||
1 0 1 purple 0x5
|
* | 0 | 1 | 1 | aqua | 0x4 | |
|
||||||
1 1 0 yellow 0x6 (more of a mustard - green color)
|
* | 1 | 0 | 1 | purple | 0x5 | |
|
||||||
1 1 1 white 0x7 (a very blue-ish white)
|
* | 1 | 1 | 0 | yellow | 0x6 | more of a mustard - green color |
|
||||||
*/
|
* | 1 | 1 | 1 | white | 0x7 | a very blue-ish white |
|
||||||
|
*
|
||||||
|
* @param argc POSIX number of parameters
|
||||||
|
* @param argv Array of parameters
|
||||||
|
*/
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char code = 0;
|
unsigned char code = 0;
|
||||||
|
Reference in New Issue
Block a user