Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
ht16k33_i2c [2017/10/21 01:03] colin |
ht16k33_i2c [2017/10/21 01:17] (Version actuelle) colin |
||
---|---|---|---|
Ligne 67: | Ligne 67: | ||
for(i=0 ; i<4 ; i++) { | for(i=0 ; i<4 ; i++) { | ||
if(i==2) // 2 points | if(i==2) // 2 points | ||
- | addr+=2; | + | addr+=2; |
- | wiringPiI2CWriteReg8(fd, addr++, displaybuffer[i+offset] & 0xFF); | + | wiringPiI2CWriteReg8(fd, addr++, displaybuffer[i+offset] & 0xFF); |
- | wiringPiI2CWriteReg8(fd, addr++, displaybuffer[i+offset] >> 8); | + | wiringPiI2CWriteReg8(fd, addr++, displaybuffer[i+offset] >> 8); |
} | } | ||
} | } | ||
Ligne 112: | Ligne 112: | ||
int num = 0; | int num = 0; | ||
while(true) { | while(true) { | ||
- | // write | + | // write first display |
writeDigitNum(0, num, false); | writeDigitNum(0, num, false); | ||
writeDigitNum(1, (num + 1) % 10, false); | writeDigitNum(1, (num + 1) % 10, false); | ||
Ligne 118: | Ligne 118: | ||
writeDigitNum(3, (num + 3) % 10, false); | writeDigitNum(3, (num + 3) % 10, false); | ||
+ | // write second display | ||
writeDigitNum(4, (num + 4) % 10, false); | writeDigitNum(4, (num + 4) % 10, false); | ||
writeDigitNum(5, (num + 5) % 10, false); | writeDigitNum(5, (num + 5) % 10, false); | ||
Ligne 123: | Ligne 124: | ||
writeDigitNum(7, (num + 7) % 10, false); | writeDigitNum(7, (num + 7) % 10, false); | ||
+ | // write third display | ||
writeDigitNum(8, (num + 8) % 10, false); | writeDigitNum(8, (num + 8) % 10, false); | ||
writeDigitNum(9, (num + 9) % 10, false); | writeDigitNum(9, (num + 9) % 10, false); | ||
Ligne 128: | Ligne 130: | ||
writeDigitNum(11, (num + 11) % 10, false); | writeDigitNum(11, (num + 11) % 10, false); | ||
- | // write display | + | // write displays |
writeDisplay(fda, 0); | writeDisplay(fda, 0); | ||
writeDisplay(fdb, 4); | writeDisplay(fdb, 4); |