Library for Grove IR receiver, to be used with NCS36510 mbed board

Fork of RemoteIR by Shinichiro Nakamura

Files at this revision

API Documentation at this revision

Comitter:
shintamainjp
Date:
Sat Aug 21 11:01:31 2010 +0000
Parent:
3:dfed23b157e6
Child:
5:e158c85c55ff
Commit message:

Changed in this revision

ReceiverIR.cpp Show annotated file Show diff for this revision Revisions of this file
ReceiverIR.h Show annotated file Show diff for this revision Revisions of this file
--- a/ReceiverIR.cpp	Sat Aug 21 04:46:14 2010 +0000
+++ b/ReceiverIR.cpp	Sat Aug 21 11:01:31 2010 +0000
@@ -33,12 +33,10 @@
     return s;
 }
 
-int ReceiverIR::getData(RemoteIR::Format *format, uint8_t *buf, int bufsiz) {
+int ReceiverIR::getData(RemoteIR::Format *format, uint8_t *buf, int bitlength) {
     IRQ_DISABLE();
 
-    const int bitcount = data.bitcount;
-    const int n = bitcount / 8 + (((bitcount % 8) != 0) ? 1 : 0);
-    if (bufsiz < n) {
+    if (bitlength < data.bitcount) {
         IRQ_ENABLE();
         return -1;
     }
--- a/ReceiverIR.h	Sat Aug 21 04:46:14 2010 +0000
+++ b/ReceiverIR.h	Sat Aug 21 11:01:31 2010 +0000
@@ -52,11 +52,11 @@
      *
      * @param format Pointer to format.
      * @param buf Buffer of data.
-     * @param bufsiz Buffer byte size.
+     * @param bitlength Bit length of the buffer.
      *
      * @return Data bit length.
      */
-    int getData(RemoteIR::Format *format, uint8_t *buf, int bufsiz);
+    int getData(RemoteIR::Format *format, uint8_t *buf, int bitlength);
     
 private: