chiark / gitweb /
Added C++ wrappers for some of the newer .h files
authorGordon Henderson <gordon@drogon.net>
Sat, 25 Aug 2012 11:31:14 +0000 (12:31 +0100)
committerGordon Henderson <gordon@drogon.net>
Sat, 25 Aug 2012 11:31:14 +0000 (12:31 +0100)
examples/softPwm.c
wiringPi/lcd.h
wiringPi/piNes.h
wiringPi/softPwm.h

index e558c4bd258c13fa29931c968bc7bada94eb7298..09b4ae0d6c2bfe9455464f7775cf94c14fd1dc53 100644 (file)
@@ -16,6 +16,7 @@ int values [NUM_LEDS] = { 0, 17, 32, 50, 67, 85, 100, 85, 67, 50, 32, 17 } ;
 int main ()
 {
   int i, j ;
+  char buf [80] ;
 
   if (wiringPiSetup () == -1)
   {
@@ -29,6 +30,30 @@ int main ()
     printf ("%3d, %3d, %3d\n", i, ledMap [i], values [i]) ;
   }
 
+  fgets (buf, 80, stdin) ;
+
+// Bring all up one by one:
+
+  for (i = 0 ; i < NUM_LEDS ; ++i)
+    for (j = 0 ; j <= 100 ; ++j)
+    {
+      softPwmWrite (ledMap [i], j) ;
+      delay (10) ;
+    }
+
+  fgets (buf, 80, stdin) ;
+
+// Down fast
+
+  for (i = 100 ; i > 0 ; --i)
+  {
+    for (j = 0 ; j < NUM_LEDS ; ++j)
+      softPwmWrite (ledMap [j], i) ;
+    delay (10) ;
+  }
+
+  fgets (buf, 80, stdin) ;
+
   for (;;)
   {
     for (i = 0 ; i < NUM_LEDS ; ++i)
index 094f5f50022ad7760764fe00072c9090f24a41fb..d4c724c0a757db0a2db881fb278fffbb10b81dc8 100644 (file)
@@ -33,5 +33,13 @@ extern void lcdPutchar  (int fd, uint8_t data) ;
 extern void lcdPuts     (int fd, char *string) ;
 extern void lcdPrintf   (int fd, char *message, ...) ;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int  lcdInit (int rows, int cols, int bits, int rs, int strb,
        int d0, int d1, int d2, int d3, int d4, int d5, int d6, int d7) ;
+
+#ifdef __cplusplus
+}
+#endif
index b76c415110029df9eb1a0b3323f0481ab62ab44b..897f1815915e83b7572a0ae61f29b1cad51bf76b 100644 (file)
 #define        NES_B           0x40
 #define        NES_A           0x80
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int          setupNesJoystick (int dPin, int cPin, int lPin) ;
 extern unsigned int  readNesJoystick (int joystick) ;
+
+#ifdef __cplusplus
+}
+#endif
index 4a17cb0ef186788aff8b6c4d15742fa38872a1a4..28ad29960f54c576ad86aee084501550ddc949c1 100644 (file)
  ***********************************************************************
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int  softPwmCreate (int pin, int value, int range) ;
 extern void softPwmWrite  (int pin, int value) ;
+
+#ifdef __cplusplus
+}
+#endif