SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html
Dependents: SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more
Fork of YDwifiInterface by
YDwifi/YDwifi.h@0:61c402886fbb, 2014-03-06 (annotated)
- Committer:
- kishino
- Date:
- Thu Mar 06 11:13:00 2014 +0000
- Revision:
- 0:61c402886fbb
- Child:
- 2:0ba43344c814
The common method which creates a UART command request was created.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kishino | 0:61c402886fbb | 1 | #ifndef _YD_WIFI_H_ |
| kishino | 0:61c402886fbb | 2 | #define _YD_WIFI_H_ |
| kishino | 0:61c402886fbb | 3 | |
| kishino | 0:61c402886fbb | 4 | #include "mbed.h" |
| kishino | 0:61c402886fbb | 5 | #include "rtos.h" |
| kishino | 0:61c402886fbb | 6 | #include "RawSerial.h" |
| kishino | 0:61c402886fbb | 7 | //#include "CBuffer.h" |
| kishino | 0:61c402886fbb | 8 | |
| kishino | 0:61c402886fbb | 9 | /** C_YDwifi class |
| kishino | 0:61c402886fbb | 10 | */ |
| kishino | 0:61c402886fbb | 11 | class C_YDwifi |
| kishino | 0:61c402886fbb | 12 | { |
| kishino | 0:61c402886fbb | 13 | |
| kishino | 0:61c402886fbb | 14 | public: |
| kishino | 0:61c402886fbb | 15 | /** Wi-Fi security |
| kishino | 0:61c402886fbb | 16 | */ |
| kishino | 0:61c402886fbb | 17 | typedef enum SECURITY { |
| kishino | 0:61c402886fbb | 18 | e_SEC_OPEN = 0x00, |
| kishino | 0:61c402886fbb | 19 | e_SEC_WEP = 0x01, |
| kishino | 0:61c402886fbb | 20 | e_SEC_WPA_TKIP = 0x02, |
| kishino | 0:61c402886fbb | 21 | e_SEC_WPA2_AES = 0x04, |
| kishino | 0:61c402886fbb | 22 | e_SEC_WPA2_MIXED = 0x06, |
| kishino | 0:61c402886fbb | 23 | e_SEC_WPA_AES = 0x07 |
| kishino | 0:61c402886fbb | 24 | }E_SECURITY; |
| kishino | 0:61c402886fbb | 25 | |
| kishino | 0:61c402886fbb | 26 | // ----- YDwifi.cpp ----- |
| kishino | 0:61c402886fbb | 27 | /** Constructor |
| kishino | 0:61c402886fbb | 28 | * \param tx mbed pin to use for tx line of Serial interface |
| kishino | 0:61c402886fbb | 29 | * \param rx mbed pin to use for rx line of Serial interface |
| kishino | 0:61c402886fbb | 30 | * \param cts mbed pin to use for cts line of Serial interface |
| kishino | 0:61c402886fbb | 31 | * \param rts mbed pin to use for rts line of Serial interface |
| kishino | 0:61c402886fbb | 32 | * \param reset reset pin of the wifi module |
| kishino | 0:61c402886fbb | 33 | * \param alarm alarm pin of the wifi module |
| kishino | 0:61c402886fbb | 34 | * \param baud baud rate of Serial interface |
| kishino | 0:61c402886fbb | 35 | */ |
| kishino | 0:61c402886fbb | 36 | C_YDwifi (PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud); |
| kishino | 0:61c402886fbb | 37 | |
| kishino | 0:61c402886fbb | 38 | int initUart(); |
| kishino | 0:61c402886fbb | 39 | |
| kishino | 0:61c402886fbb | 40 | static C_YDwifi * getInstance() { |
| kishino | 0:61c402886fbb | 41 | return mInstance_p; |
| kishino | 0:61c402886fbb | 42 | }; |
| kishino | 0:61c402886fbb | 43 | Thread *mUartRecvThread_p; |
| kishino | 0:61c402886fbb | 44 | |
| kishino | 0:61c402886fbb | 45 | protected: |
| kishino | 0:61c402886fbb | 46 | static C_YDwifi *mInstance_p; |
| kishino | 0:61c402886fbb | 47 | |
| kishino | 0:61c402886fbb | 48 | Mutex mUartMutex; |
| kishino | 0:61c402886fbb | 49 | // RawSerial mUart; |
| kishino | 0:61c402886fbb | 50 | Serial mUart; |
| kishino | 0:61c402886fbb | 51 | DigitalInOut mModuleReset; |
| kishino | 0:61c402886fbb | 52 | |
| kishino | 0:61c402886fbb | 53 | /* Function */ |
| kishino | 0:61c402886fbb | 54 | void uartIntr_callback( void ); |
| kishino | 0:61c402886fbb | 55 | static void uartRecvThread( void const *args_p ); |
| kishino | 0:61c402886fbb | 56 | }; |
| kishino | 0:61c402886fbb | 57 | |
| kishino | 0:61c402886fbb | 58 | #endif |
muRata

Murata TypeYD