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

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

62
     return c;
62
     return c;
63
 }
63
 }
64
 
64
 
65
-}; // namespace AjK ends
65
+} // namespace AjK ends

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

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

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

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
     }        
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
 
33
 
34
 MODSERIAL::MODSERIAL( PinName tx, PinName rx, const char* name ) : Serial( tx, rx, name )
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
 MODSERIAL::MODSERIAL( PinName tx, PinName rx, int bufferSize, const char* name ) : Serial( tx, rx, name )
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
 MODSERIAL::MODSERIAL( PinName tx, PinName rx, int txSize, int rxSize, const char* name ) : Serial( tx, rx, name )
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
 MODSERIAL::~MODSERIAL()
49
 MODSERIAL::~MODSERIAL()
77
     return MODSERIAL_RX_BUFFER_EMPTY; 
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
 void
86
 void
87
 MODSERIAL::disableIrq( void )
87
 MODSERIAL::disableIrq( void )
134
 }
134
 }
135
 
135
 
136
 
136
 
137
-}; // namespace AjK ends
137
+} // namespace AjK ends

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

41
 #define MODSERIAL_DEFAULT_TX_BUFFER_SIZE    256
41
 #define MODSERIAL_DEFAULT_TX_BUFFER_SIZE    256
42
 #endif
42
 #endif
43
 
43
 
44
+#pragma GCC diagnostic push
45
+#pragma GCC diagnostic ignored "-Wunused-parameter"
46
+#pragma GCC diagnostic ignored "-pedantic"
44
 #include "mbed.h"
47
 #include "mbed.h"
48
+#pragma GCC diagnostic pop
49
+
45
 #include "serial_api.h"
50
 #include "serial_api.h"
46
 
51
 
47
 namespace AjK {
52
 namespace AjK {
436
      * @see attach
441
      * @see attach
437
      * @ingroup API
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
      * @see attach
447
      * @see attach
443
      * @ingroup API
448
      * @ingroup API
517
      * @ingroup API
522
      * @ingroup API
518
      * @return The length iof the TX buffer in bytes
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
      * Function: rxBufferGetSize
528
      * Function: rxBufferGetSize
524
      *  
529
      *  
527
      * @ingroup API
532
      * @ingroup API
528
      * @return The length iof the RX buffer in bytes
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
      * Function: txBufferFull
538
      * Function: txBufferFull
534
      *  
539
      *  
932
      * Initialize the MODSERIAL object
937
      * Initialize the MODSERIAL object
933
      * @ingroup INTERNALS
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
      * Function: flushBuffer
943
      * Function: flushBuffer
1082
 
1087
 
1083
 };
1088
 };
1084
 
1089
 
1085
-}; // namespace AjK ends
1090
+} // namespace AjK ends
1086
 
1091
 
1087
 using namespace AjK;
1092
 using namespace AjK;
1088
 
1093
 

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

35
     return serial->rxDiscardLastChar(); 
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
     return 0;
78
     return 0;
79
 }
79
 }
80
 
80
 
81
-}; // namespace AjK ends
81
+} // namespace AjK ends

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

120
     return Ok;
120
     return Ok;
121
 }
121
 }
122
 
122
 
123
-}; // namespace AjK ends
123
+} // namespace AjK ends

+ 9
- 0
makefile View File

113
 	LINKER += -Llib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM
113
 	LINKER += -Llib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM
114
 	LINKER += -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
114
 	LINKER += -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
115
 	LINKER += -lmbed
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
 	OBJ = lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/board.o
125
 	OBJ = lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/board.o
117
 	OBJ += lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/cmsis_nvic.o
126
 	OBJ += lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/cmsis_nvic.o
118
 	OBJ += lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/retarget.o
127
 	OBJ += lib/mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/retarget.o

Loading…
Cancel
Save