Browse Source

Modified MODSERIAL to compile with -Wall -Wextra -pedantic -Werror

Thomas Buck 8 years ago
parent
commit
814d70b06e

+ 3
- 1
lib/MODSERIAL/FLUSH.cpp View File

@@ -32,6 +32,7 @@ MODSERIAL::flushBuffer(IrqType type)
32 32
     switch(type) {
33 33
         case TxIrq: _IER &= ~(1UL << 1); break;
34 34
         case RxIrq: _IER &= ~(1UL << 0); break;
35
+        default: break;
35 36
     }
36 37
     buffer_in[type]       = 0;
37 38
     buffer_out[type]      = 0;
@@ -40,8 +41,9 @@ MODSERIAL::flushBuffer(IrqType type)
40 41
     switch(type) {
41 42
         case TxIrq: _FCR = MODSERIAL_FIFO_TX_RESET; break;
42 43
         case RxIrq: _FCR = MODSERIAL_FIFO_RX_RESET; break;
44
+        default: break;
43 45
     }
44 46
     _IER = ier;
45 47
 }
46 48
 
47
-}; // namespace AjK ends
49
+} // namespace AjK ends

+ 1
- 1
lib/MODSERIAL/GETC.cpp View File

@@ -62,4 +62,4 @@ MODSERIAL::__getc(bool block)
62 62
     return c;
63 63
 }
64 64
 
65
-}; // namespace AjK ends
65
+} // namespace AjK ends

+ 2
- 2
lib/MODSERIAL/INIT.cpp View File

@@ -27,7 +27,7 @@
27 27
 namespace AjK {
28 28
 
29 29
 void
30
-MODSERIAL::init( int txSize, int rxSize, PinName rx )
30
+MODSERIAL::init( int txSize, int rxSize )
31 31
 {
32 32
     disableIrq();
33 33
     
@@ -78,4 +78,4 @@ MODSERIAL::init( int txSize, int rxSize, PinName rx )
78 78
     enableIrq();
79 79
 }
80 80
 
81
-}; // namespace AjK ends
81
+} // namespace AjK ends

+ 1
- 1
lib/MODSERIAL/ISR_RX.cpp View File

@@ -56,5 +56,5 @@ MODSERIAL::isr_rx(void)
56 56
     }    
57 57
 }
58 58
 
59
-}; // namespace AjK ends
59
+} // namespace AjK ends
60 60
 

+ 2
- 1
lib/MODSERIAL/ISR_TX.cpp View File

@@ -49,6 +49,7 @@ MODSERIAL::isr_tx(bool doCallback)
49 49
     }        
50 50
 }
51 51
 
52
-}; // namespace AjK ends
52
+} // namespace AjK ends
53
+
53 54
 
54 55
         

+ 9
- 9
lib/MODSERIAL/MODSERIAL.cpp View File

@@ -33,17 +33,17 @@ namespace AjK {
33 33
 
34 34
 MODSERIAL::MODSERIAL( PinName tx, PinName rx, const char* name ) : Serial( tx, rx, name )
35 35
 {
36
-    init( MODSERIAL_DEFAULT_TX_BUFFER_SIZE, MODSERIAL_DEFAULT_RX_BUFFER_SIZE, rx );
36
+    init( MODSERIAL_DEFAULT_TX_BUFFER_SIZE, MODSERIAL_DEFAULT_RX_BUFFER_SIZE );
37 37
 }
38 38
 
39 39
 MODSERIAL::MODSERIAL( PinName tx, PinName rx, int bufferSize, const char* name ) : Serial( tx, rx, name )
40 40
 {
41
-    init( bufferSize, bufferSize, rx );
41
+    init( bufferSize, bufferSize );
42 42
 }
43 43
 
44 44
 MODSERIAL::MODSERIAL( PinName tx, PinName rx, int txSize, int rxSize, const char* name ) : Serial( tx, rx, name )
45 45
 {
46
-    init( txSize, rxSize, rx );
46
+    init( txSize, rxSize );
47 47
 }
48 48
 
49 49
 MODSERIAL::~MODSERIAL()
@@ -77,11 +77,11 @@ MODSERIAL::rxBufferEmpty( void )
77 77
     return MODSERIAL_RX_BUFFER_EMPTY; 
78 78
 }
79 79
 
80
-bool 
81
-MODSERIAL::txIsBusy( void ) 
82
-{ 
83
-    return ( _LSR & ( 3UL << 5 ) == 0 ) ? true : false; 
84
-} 
80
+bool
81
+MODSERIAL::txIsBusy( void )
82
+{
83
+    return ( ( _LSR & ( 3UL << 5 ) ) == 0 ) ? true : false;
84
+}
85 85
 
86 86
 void
87 87
 MODSERIAL::disableIrq( void )
@@ -134,4 +134,4 @@ MODSERIAL::rxDiscardLastChar( void )
134 134
 }
135 135
 
136 136
 
137
-}; // namespace AjK ends
137
+} // namespace AjK ends

+ 13
- 8
lib/MODSERIAL/MODSERIAL.h View File

@@ -41,7 +41,12 @@
41 41
 #define MODSERIAL_DEFAULT_TX_BUFFER_SIZE    256
42 42
 #endif
43 43
 
44
+#pragma GCC diagnostic push
45
+#pragma GCC diagnostic ignored "-Wunused-parameter"
46
+#pragma GCC diagnostic ignored "-pedantic"
44 47
 #include "mbed.h"
48
+#pragma GCC diagnostic pop
49
+
45 50
 #include "serial_api.h"
46 51
 
47 52
 namespace AjK {
@@ -436,8 +441,8 @@ public:
436 441
      * @see attach
437 442
      * @ingroup API
438 443
      */
439
-    void connect(void (*fptr)(MODSERIAL_IRQ_INFO *), IrqType type = RxIrq) { _isr[RxIrq].attach(fptr); }
440
-    
444
+    void connect(void (*fptr)(MODSERIAL_IRQ_INFO *), IrqType type = RxIrq) { _isr[type].attach(fptr); }
445
+
441 446
     /**
442 447
      * @see attach
443 448
      * @ingroup API
@@ -517,8 +522,8 @@ public:
517 522
      * @ingroup API
518 523
      * @return The length iof the TX buffer in bytes
519 524
      */
520
-    int txBufferGetSize(int size) { return buffer_size[TxIrq]; } 
521
-    
525
+    int txBufferGetSize() { return buffer_size[TxIrq]; }
526
+
522 527
     /**
523 528
      * Function: rxBufferGetSize
524 529
      *  
@@ -527,8 +532,8 @@ public:
527 532
      * @ingroup API
528 533
      * @return The length iof the RX buffer in bytes
529 534
      */
530
-    int rxBufferGetSize(int size) { return buffer_size[RxIrq]; } 
531
-    
535
+    int rxBufferGetSize() { return buffer_size[RxIrq]; }
536
+
532 537
     /**
533 538
      * Function: txBufferFull
534 539
      *  
@@ -932,7 +937,7 @@ private:
932 937
      * Initialize the MODSERIAL object
933 938
      * @ingroup INTERNALS
934 939
      */
935
-    void init(int txSize, int rxSize, PinName rx);
940
+    void init(int txSize, int rxSize);
936 941
     
937 942
     /** 
938 943
      * Function: flushBuffer
@@ -1082,7 +1087,7 @@ protected:
1082 1087
 
1083 1088
 };
1084 1089
 
1085
-}; // namespace AjK ends
1090
+} // namespace AjK ends
1086 1091
 
1087 1092
 using namespace AjK;
1088 1093
 

+ 1
- 1
lib/MODSERIAL/MODSERIAL_IRQ_INFO.cpp View File

@@ -35,4 +35,4 @@ MODSERIAL_IRQ_INFO::rxDiscardLastChar(void)
35 35
     return serial->rxDiscardLastChar(); 
36 36
 }
37 37
 
38
-}; // namespace AjK ends
38
+} // namespace AjK ends

+ 1
- 1
lib/MODSERIAL/PUTC.cpp View File

@@ -78,4 +78,4 @@ MODSERIAL::__putc(int c, bool block) {
78 78
     return 0;
79 79
 }
80 80
 
81
-}; // namespace AjK ends
81
+} // namespace AjK ends

+ 1
- 1
lib/MODSERIAL/RESIZE.cpp View File

@@ -120,4 +120,4 @@ MODSERIAL::upSizeBuffer(int size, IrqType type, bool memory_check)
120 120
     return Ok;
121 121
 }
122 122
 
123
-}; // namespace AjK ends
123
+} // namespace AjK ends

+ 9
- 0
makefile View File

@@ -113,6 +113,15 @@ else
113 113
 	LINKER += -Llib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM
114 114
 	LINKER += -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
115 115
 	LINKER += -lmbed
116
+	CPPSRC += lib/MODSERIAL/FLUSH.cpp
117
+	CPPSRC += lib/MODSERIAL/GETC.cpp
118
+	CPPSRC += lib/MODSERIAL/INIT.cpp
119
+	CPPSRC += lib/MODSERIAL/ISR_RX.cpp
120
+	CPPSRC += lib/MODSERIAL/ISR_TX.cpp
121
+	CPPSRC += lib/MODSERIAL/MODSERIAL_IRQ_INFO.cpp
122
+	CPPSRC += lib/MODSERIAL/MODSERIAL.cpp
123
+	CPPSRC += lib/MODSERIAL/PUTC.cpp
124
+	CPPSRC += lib/MODSERIAL/RESIZE.cpp
116 125
 	OBJ = lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/board.o
117 126
 	OBJ += lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/cmsis_nvic.o
118 127
 	OBJ += lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/retarget.o

Loading…
Cancel
Save