hepta xbee

Files at this revision

API Documentation at this revision

Comitter:
RyusukeIwata
Date:
Mon Nov 14 09:16:53 2022 +0000
Parent:
12:94abebd3d020
Commit message:
changed to rawserial

Changed in this revision

HeptaXbee.cpp Show annotated file Show diff for this revision Revisions of this file
HeptaXbee.h Show annotated file Show diff for this revision Revisions of this file
diff -r 94abebd3d020 -r 80fa501a73a0 HeptaXbee.cpp
--- a/HeptaXbee.cpp	Wed Aug 21 11:18:56 2019 +0000
+++ b/HeptaXbee.cpp	Mon Nov 14 09:16:53 2022 +0000
@@ -2,15 +2,16 @@
 #include "mbed.h"
 #include  <stdarg.h>
 
-HeptaXbee::HeptaXbee(PinName tx, PinName rx) : xbee(tx,rx)
+int rate = 9600;
+HeptaXbee::HeptaXbee(PinName tx, PinName rx) : xbee(tx,rx,rate)
 {
     rcmd = 0;
     cmdflag = 0;
 }
-void HeptaXbee::baud(int rate)
-{
-    xbee.baud(rate);
-}
+//void HeptaXbee::baud(int rate)
+//{
+//    xbee.baud(rate);
+//}
 void HeptaXbee::xbee_receive(int *xrcmd, int *xcmdflag)
 {
     xbee.attach(this,&HeptaXbee::commandget,Serial::RxIrq);
@@ -137,10 +138,10 @@
     while ( char c    = *s++ )
         xbee.putc( c );
 }
-void HeptaXbee::scanf(char *format, ... )
-{
-    xbee.scanf(format);
-}
+//void HeptaXbee::scanf(char *format, ... )
+//{
+//    xbee.scanf(format);
+//}
 void HeptaXbee::printf( char *format, ... )
 {
     char        s[ 100 ];
diff -r 94abebd3d020 -r 80fa501a73a0 HeptaXbee.h
--- a/HeptaXbee.h	Wed Aug 21 11:18:56 2019 +0000
+++ b/HeptaXbee.h	Mon Nov 14 09:16:53 2022 +0000
@@ -7,14 +7,14 @@
 class HeptaXbee
 {
 public:
-    Serial xbee;
+    RawSerial xbee;
     int rcmd;
     int cmdflag;
     HeptaXbee(
         PinName tx,
         PinName rx
     );
-    void baud(int rate);
+//    void baud(int rate);
     void xbee_receive(int *xrcmd, int *xcmdflag);
     void initialize();
     void commandget();
@@ -22,7 +22,7 @@
                        char dataF[],char dataG[],char dataH[],char dataI[],char dataJ[],
                        char dataK[],char dataL[],char dataM[],char dataN[]);
     void puts( char *s );
-    void scanf(char *format, ... );
+//    void scanf(char *format, ... );
     void printf(char *format, ... );
     void putc(char data);
     char getc();