_Very_ simple wrapper to a WiFly module connected via serial port.
wifly.h@0:b5ee41a1ca65, 2011-06-16 (annotated)
- Committer:
- tylerwilson
- Date:
- Thu Jun 16 22:05:55 2011 +0000
- Revision:
- 0:b5ee41a1ca65
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tylerwilson | 0:b5ee41a1ca65 | 1 | /** |
tylerwilson | 0:b5ee41a1ca65 | 2 | * Wrapper for the WiFly module, using the serial port. |
tylerwilson | 0:b5ee41a1ca65 | 3 | * |
tylerwilson | 0:b5ee41a1ca65 | 4 | * Copyright 2010 Pulse-Robotics, Inc. |
tylerwilson | 0:b5ee41a1ca65 | 5 | * John Sosoka, Tyler Wilson |
tylerwilson | 0:b5ee41a1ca65 | 6 | */ |
tylerwilson | 0:b5ee41a1ca65 | 7 | |
tylerwilson | 0:b5ee41a1ca65 | 8 | #ifndef __wifly_h__ |
tylerwilson | 0:b5ee41a1ca65 | 9 | #define __wifly_h__ |
tylerwilson | 0:b5ee41a1ca65 | 10 | |
tylerwilson | 0:b5ee41a1ca65 | 11 | #include "mbed.h" |
tylerwilson | 0:b5ee41a1ca65 | 12 | |
tylerwilson | 0:b5ee41a1ca65 | 13 | |
tylerwilson | 0:b5ee41a1ca65 | 14 | class WiFly { |
tylerwilson | 0:b5ee41a1ca65 | 15 | |
tylerwilson | 0:b5ee41a1ca65 | 16 | public: |
tylerwilson | 0:b5ee41a1ca65 | 17 | /** Create a WiFly object connected to the specified serial pins |
tylerwilson | 0:b5ee41a1ca65 | 18 | * |
tylerwilson | 0:b5ee41a1ca65 | 19 | * @param tx TX pin of the Serial port |
tylerwilson | 0:b5ee41a1ca65 | 20 | * @param rx RX pin of the Serial port |
tylerwilson | 0:b5ee41a1ca65 | 21 | */ |
tylerwilson | 0:b5ee41a1ca65 | 22 | WiFly(PinName tx, PinName rx); |
tylerwilson | 0:b5ee41a1ca65 | 23 | |
tylerwilson | 0:b5ee41a1ca65 | 24 | void commandMode() const; |
tylerwilson | 0:b5ee41a1ca65 | 25 | void dataMode() const; |
tylerwilson | 0:b5ee41a1ca65 | 26 | |
tylerwilson | 0:b5ee41a1ca65 | 27 | // Serial methods. Could also derive from Serial... |
tylerwilson | 0:b5ee41a1ca65 | 28 | void baud(int baudrate=9600); |
tylerwilson | 0:b5ee41a1ca65 | 29 | int getc(); |
tylerwilson | 0:b5ee41a1ca65 | 30 | void putc(int c); |
tylerwilson | 0:b5ee41a1ca65 | 31 | int readable(); |
tylerwilson | 0:b5ee41a1ca65 | 32 | |
tylerwilson | 0:b5ee41a1ca65 | 33 | private: |
tylerwilson | 0:b5ee41a1ca65 | 34 | Serial* port; |
tylerwilson | 0:b5ee41a1ca65 | 35 | }; |
tylerwilson | 0:b5ee41a1ca65 | 36 | |
tylerwilson | 0:b5ee41a1ca65 | 37 | |
tylerwilson | 0:b5ee41a1ca65 | 38 | #endif /* __wifly_h__ */ |