1
0

wiringpi works

This commit is contained in:
dtb 2023-09-13 01:07:06 -04:00
parent c39523fff4
commit 4161fad929
5 changed files with 35 additions and 2 deletions

View File

@ -146,12 +146,15 @@ $(PREFIX)/bin/scrot:
sh -c 'cd $(PREFIX)/src/scrot && ./autogen.sh && ./configure MAKE=$(MAKE) PREFIX=$(PREFIX)'
$(MAKE) -C $(PREFIX)/src/scrot install
# I tried final_official_2.50 but it wouldn't build
# (ld: error: duplicate symbol: comDat)
# depends on
# apk:sudo
$(PREFIX)/src/wiringpi:
git clone https://github.com/WiringPi/WiringPi.git $(PREFIX)/src/wiringpi
git -C $(PREFIX)/src/wiringpi checkout final_official_2.50
sed -i .tmp -e /^sudo/d $(PREFIX)/src/wiringpi/build
git -C $(PREFIX)/src/wiringpi checkout 2.61-1
sed -i .old -e /^sudo/d $(PREFIX)/src/wiringpi/build
sed -i .old -e s/root\.root/root\:root/ $(PREFIX)/src/wiringpi/gpio
sh -c 'cd $(PREFIX)/src/wiringpi; sudo=sudo ./build'
$(PREFIX)/bin/xdo:

3
ht16k33/Makefile Normal file
View File

@ -0,0 +1,3 @@
CFLAGS += -I/usr/local/include -L/usr/local/lib
ht16k33: ht16k33.c
$(CC) $(CFLAGS) -lwiringPi -o ht16k33 ht16k33.c

2
ht16k33/README.txt Normal file
View File

@ -0,0 +1,2 @@
This program depends on WiringPi. Build instructions can be found in the
Makefile in the root of this project.

14
ht16k33/ht16k33.c Normal file
View File

@ -0,0 +1,14 @@
#include <unistd.h>
#include <wiringPiI2C.h>
#include "ht16k33.h"
/* https://cdn-shop.adafruit.com/datasheets/ht16K33v110.pdf */
#define ADDRESS 0x70
int main(int argc, char *argv[]){
int fd;
fd = wiringPiI2CSetup(ADDRESS);
close(fd);
}

11
ht16k33/ht16k33.h Normal file
View File

@ -0,0 +1,11 @@
/* Definitions were determined by reading Adafruit code and the datasheet. */
#define HT16K33_SYSTEM_CMD 0x20 /* 0b0010???x */
#define HT16K33_SYSTEM_ON 0x01 /* 0b00000001 */
#define HT16K33_SYSTEM_OFF 0x00 /* 0b00000000 */
/* `0xE0 | n`, where 0 <= n <= 15 and the display dims to (n+1)/16 duty */
#define HT16K33_CMD_BRIGHTNESS 0xE0 /* 0b1110xxxx */
#define HT16K33_BLINK_CMD 0x80 /* 0b1000?xxx */
#define HT16K33_BLINK_DISPLAYON 0x01 /* 0b1000???x */