Minor changes to the PiGlow code - got the orange & yellow the right way

round at last..

Updated for the 0x0012 board revision on the new A+
This commit is contained in:
Gordon Henderson
2014-11-10 10:55:23 +00:00
parent df45388f64
commit 0a9fdeb29d
11 changed files with 264 additions and 40 deletions

View File

@@ -77,18 +77,18 @@ $(DYNAMIC): $(OBJ)
@echo [Compile] $<
@$(CC) -c $(CFLAGS) $< -o $@
.PHONEY: clean
.PHONY: clean
clean:
@echo "[Clean]"
@rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
.PHONEY: tags
.PHONY: tags
tags: $(SRC)
@echo [ctags]
@ctags $(SRC)
.PHONEY: install-headers
.PHONY: install-headers
install-headers:
@echo "[Install Headers]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
@@ -116,7 +116,7 @@ install-headers:
@install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 sn3218.h $(DESTDIR)$(PREFIX)/include
.PHONEY: install
.PHONY: install
install: $(DYNAMIC) install-headers
@echo "[Install Dynamic Lib]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
@@ -124,13 +124,13 @@ install: $(DYNAMIC) install-headers
@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
@ldconfig
.PHONEY: install-static
.PHONY: install-static
install-static: $(STATIC) install-headers
@echo "[Install Static Lib]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
@install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
.PHONEY: uninstall
.PHONY: uninstall
uninstall:
@echo "[UnInstall]"
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
@@ -160,7 +160,7 @@ uninstall:
@ldconfig
.PHONEY: depend
.PHONY: depend
depend:
makedepend -Y $(SRC) $(SRC_I2C)

View File

@@ -203,13 +203,14 @@ static volatile uint32_t *timerIrqRaw ;
// and PI_VERSION_X defines in wiringPi.h
// Only intended for the gpio command - use at your own risk!
const char *piModelNames [5] =
const char *piModelNames [6] =
{
"Unknown",
"Model A",
"Model B",
"Model B+",
"Compute Module",
"Model A+",
} ;
const char *piRevisionNames [5] =
@@ -620,6 +621,7 @@ int wiringPiFailure (int fatal, const char *message, ...)
* 000f - Model B, Rev 2, 512MB, Qisda
* 0010 - Model B+, Rev 1.2, 512MB, Sony
* 0011 - Pi CM, Rev 1.2, 512MB, Sony
* 0012 - Model A+ Rev 1.2, 256MB, Sony
*
* A small thorn is the olde style overvolting - that will add in
* 1000000
@@ -687,10 +689,12 @@ int piBoardRev (void)
// If you have overvolted the Pi, then it appears that the revision
// has 100000 added to it!
// The actual condition for it being set is:
// (force_turbo || current_limit_override || temp_limit>85) && over_voltage>0
if (wiringPiDebug)
if (strlen (c) != 4)
printf ("piboardRev: This Pi has/is overvolted!\n") ;
printf ("piboardRev: This Pi has/is (force_turbo || current_limit_override || temp_limit>85) && over_voltage>0\n") ;
// Isolate last 4 characters:
@@ -782,6 +786,7 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *overVolted)
else if (strcmp (c, "000f") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_2 ; *mem = 512 ; *maker = PI_MAKER_EGOMAN ; }
else if (strcmp (c, "0010") == 0) { *model = PI_MODEL_BP ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
else if (strcmp (c, "0011") == 0) { *model = PI_MODEL_CM ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
else if (strcmp (c, "0012") == 0) { *model = PI_MODEL_AP ; *rev = PI_VERSION_1_2 ; *mem = 256 ; *maker = PI_MAKER_SONY ; }
else { *model = 0 ; *rev = 0 ; *mem = 0 ; *maker = 0 ; }
}
@@ -1474,8 +1479,10 @@ int waitForInterrupt (int pin, int mS)
// Do a dummy read to clear the interrupt
// A one character read appars to be enough.
// Followed by a seek to reset it.
(void)read (fd, &c, 1) ;
lseek (fd, 0, SEEK_SET) ;
return x ;
}

View File

@@ -75,6 +75,7 @@
#define PI_MODEL_B 2
#define PI_MODEL_BP 3
#define PI_MODEL_CM 4
#define PI_MODEL_AP 5
#define PI_VERSION_UNKNOWN 0
#define PI_VERSION_1 1
@@ -87,7 +88,7 @@
#define PI_MAKER_SONY 2
#define PI_MAKER_QISDA 3
extern const char *piModelNames [5] ;
extern const char *piModelNames [6] ;
extern const char *piRevisionNames [5] ;
extern const char *piMakerNames [4] ;