For robots and stuff
Diff: Radio/Radio.h
- Revision:
- 2:c42a035d71ed
- Parent:
- 1:05a48c038381
diff -r 05a48c038381 -r c42a035d71ed Radio/Radio.h --- a/Radio/Radio.h Sun Dec 28 06:28:42 2014 +0000 +++ b/Radio/Radio.h Wed Dec 31 22:16:01 2014 +0000 @@ -1,8 +1,6 @@ #ifndef RADIO_H #define RADIO_H -#if 0 - #include "mbed.h" #include "rtos.h" @@ -46,8 +44,8 @@ } virtual void powerUp(void) = 0; - - void mailbox(const Mail<RTP_t, 6>*); + + bool hasError(void); protected: virtual void put_pck(uint8_t*, uint8_t) = 0; @@ -56,31 +54,35 @@ static const int BUFFER_SIZE = 70; uint8_t buffer[BUFFER_SIZE]; - Mail<RTP_t, 6> _rx_data; - Mail<RTP_t, 5> _tx_data; - bool _need_ack; uint8_t _channel; uint32_t _freq; uint8_t _addr; int8_t _rssi; + uint8_t _p_count; + static void transmit_thread(void const*); static void receive_thread(void const*); -SPI *_spi; - -private: - void isr_receive(void); - InterruptIn *_rx_int; - DigitalOut _tx_led; - DigitalOut _rx_led; - static void led_tick(void const*); + SPI *_spi; Thread _receive_thread; Thread _transmit_thread; Thread _tx_led_thread; Thread _rx_led_thread; + + InterruptIn *_rx_int; + + DigitalOut _err_led; + + bool _has_error; + +private: + void isr_receive(void); + + DigitalOut _tx_led; + DigitalOut _rx_led; + static void led_tick(void const*); }; -#endif // RADIO_H -#endif \ No newline at end of file +#endif // RADIO_H \ No newline at end of file