Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HubsanTx.h
00001 #ifndef _HUBSAN_X4_TX 00002 #define _HUBSAN_X4_TX 00003 00004 #include "A7105.h" 00005 00006 enum{ 00007 FLAG_VIDEO= 0x01, // record video 00008 FLAG_FLIP = 0x08, // enable flips 00009 FLAG_LED = 0x04 // enable LEDs 00010 }; 00011 00012 static const uint8_t kAllowedChannels[] = 00013 {0x14, 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A, 0x64, 0x6E, 0x78, 0x82}; 00014 static const uint32_t kTxId = 0xDB042679; 00015 00016 /** 00017 * Class for communicating with a Hubsan X4 using the A7105TxRx library 00018 * 00019 * Example: 00020 * @code 00021 * #include "mbed.h" 00022 * #include "HubsanTx.h" 00023 * 00024 * #define A7105_SPI_FREQUENCY 10000000 // 10MHz 00025 * 00026 * HubsanTx hubsan(D4, D5, D3, D6, A7105_SPI_FREQUENCY); 00027 * 00028 * int main() { 00029 * // init 00030 * hubsan.init(); 00031 * } 00032 * @endcode 00033 */ 00034 class HubsanTx : public A7105 { 00035 public: 00036 /** 00037 * @param mosi Pin used to transmit data to the slave 00038 * @param miso Pin used to receive data from the slave 00039 * @param clk Pin used for the clock 00040 * @param cs Pin used for the chip select 00041 * @param freqHz Frequency used to clock data in and out 00042 */ 00043 HubsanTx (PinName mosi, PinName miso, PinName clk, PinName cs, uint32_t freqHz); 00044 00045 /** 00046 * Initialize the A7105 to communicate with a Hubsan X4 00047 */ 00048 int8_t init(); 00049 00050 private: 00051 uint8_t _packet[16]; 00052 uint8_t _channel; 00053 uint32_t _sessionId; 00054 uint8_t _state; 00055 uint8_t _packetCount; 00056 }; 00057 00058 #endif // _HUBSAN_X4_TX
Generated on Sun Jul 17 2022 01:39:15 by
1.7.2