aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_halfcab.c
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-09-21 01:21:14 +0200
committerjoe <rbo@gmx.us>2025-09-21 01:21:14 +0200
commit5e5d41cffd035d73ef818d7ea1f4b191f3f008a6 (patch)
tree6a6e8dab8d66a3d8bdf30fbb571146d922cb3939 /src/c_halfcab.c
parentbetter license (diff)
downloadhalfcab-5e5d41cffd035d73ef818d7ea1f4b191f3f008a6.tar.gz
halfcab-5e5d41cffd035d73ef818d7ea1f4b191f3f008a6.tar.bz2
halfcab-5e5d41cffd035d73ef818d7ea1f4b191f3f008a6.tar.xz
halfcab-5e5d41cffd035d73ef818d7ea1f4b191f3f008a6.tar.zst
halfcab-5e5d41cffd035d73ef818d7ea1f4b191f3f008a6.zip
send colors
Diffstat (limited to 'src/c_halfcab.c')
-rw-r--r--src/c_halfcab.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/c_halfcab.c b/src/c_halfcab.c
index cab333c..d67b779 100644
--- a/src/c_halfcab.c
+++ b/src/c_halfcab.c
@@ -66,6 +66,7 @@ param_esp_com
{
struct termios tty;
+ bzero(&tty, sizeof(tty));
if (tcgetattr(fd, &tty) != 0) {
dprintf(
STDERR_FILENO,
@@ -85,7 +86,7 @@ param_esp_com
tty.c_cc[VMIN] = 1; /* read doesn't block */
tty.c_cc[VTIME] = 5; /* 0.5 seconds read timeout */
tty.c_iflag &= ~(IXON | IXOFF | IXANY); /* shut off xon/xoff ctrl */
- tty.c_cflag |= (CLOCAL | CREAD);/* ignore modem controls, enable reading */
+ tty.c_cflag |= (CLOCAL | CREAD); /* ignore modem controls, enable reading */
tty.c_cflag &= ~(PARENB | PARODD); /* no parity */
tty.c_cflag &= ~CSTOPB; /* 1 stop bit */
tty.c_cflag &= ~CRTSCTS; /* no hardware flow control */
@@ -128,10 +129,9 @@ main
{
const char* prog_name = argv[0];
int fd;
- const unsigned char com = 0xff;
+ unsigned char com[4];
+ unsigned char i;
/* const unsigned char data[2] = { 0xfe, 0x00 }; */
- /* unsigned char rgb[3];
- unsigned char i; */
fd = open_esp(prog_name);
if (fd < 0) {
@@ -142,13 +142,16 @@ main
return (EXIT_FAILURE);
}
if (argc < 4) {
+ com[0] = 0xfe;
write(fd, &com, 1 * sizeof(unsigned char));
} else {
- /* i = 1;
+ com[0] = 0xff;
+ i = 1;
while (i < 4) {
- rgb[i] = atoi(argv[i]);
+ com[i] = atoi(argv[i]);
i++;
- } */
+ }
+ write(fd, &com, 4 * sizeof(unsigned char));
}
close(fd);
return (EXIT_SUCCESS);