library for implementing ir transmission
XMIT_IR.h@6:281167565d6d, 2012-10-06 (annotated)
- Committer:
- cmulady
- Date:
- Sat Oct 06 17:36:37 2012 +0000
- Revision:
- 6:281167565d6d
- Parent:
- 5:ad52a062d494
- Child:
- 7:01243fe65940
going to remove tx interrupt handling
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cmulady | 2:2eb0a3a29b5b | 1 | #ifndef MBED_XMIT_IR_H |
cmulady | 2:2eb0a3a29b5b | 2 | #define MBED_XMIT_IR_H |
cmulady | 2:2eb0a3a29b5b | 3 | |
cmulady | 2:2eb0a3a29b5b | 4 | #include "mbed.h" |
cmulady | 2:2eb0a3a29b5b | 5 | #include "rtos.h" |
cmulady | 2:2eb0a3a29b5b | 6 | |
cmulady | 2:2eb0a3a29b5b | 7 | #define ASCII_ETX 0x03 |
cmulady | 2:2eb0a3a29b5b | 8 | #define ASCII_STX 0x02 |
cmulady | 2:2eb0a3a29b5b | 9 | |
cmulady | 2:2eb0a3a29b5b | 10 | |
cmulady | 2:2eb0a3a29b5b | 11 | class IRTransmitter |
cmulady | 2:2eb0a3a29b5b | 12 | { |
cmulady | 2:2eb0a3a29b5b | 13 | public: |
cmulady | 5:ad52a062d494 | 14 | IRTransmitter(PinName TX, PinName PWM, PinName RX, int data_buff_len, void (*fptr_isr_rx)(void), void (*fptr_isr_tx)(void)); |
cmulady | 2:2eb0a3a29b5b | 15 | ~IRTransmitter(); |
cmulady | 2:2eb0a3a29b5b | 16 | void MakePacket(char* data,int len); |
cmulady | 3:823708586b3e | 17 | char ReadPacket(char* data, int len); |
cmulady | 2:2eb0a3a29b5b | 18 | void isr_uartrx(void); |
cmulady | 5:ad52a062d494 | 19 | void isr_rx(char data); |
cmulady | 6:281167565d6d | 20 | char isr_tx(void); |
cmulady | 4:55946953c6e3 | 21 | void set_debug_port(Serial* port); |
cmulady | 2:2eb0a3a29b5b | 22 | |
cmulady | 3:823708586b3e | 23 | private: |
cmulady | 3:823708586b3e | 24 | char packet_is_valid(int data_len); |
cmulady | 3:823708586b3e | 25 | void update_packet_buffer(char new_data, int data_len); |
cmulady | 6:281167565d6d | 26 | void mail_tx_packet(char data); |
cmulady | 3:823708586b3e | 27 | |
cmulady | 2:2eb0a3a29b5b | 28 | public: |
cmulady | 5:ad52a062d494 | 29 | Mail<char,32> ir_rxdata_mailbox; |
cmulady | 5:ad52a062d494 | 30 | Mail<char,32> ir_txdata_mailbox; |
cmulady | 5:ad52a062d494 | 31 | |
cmulady | 4:55946953c6e3 | 32 | Serial* debug_port; |
cmulady | 2:2eb0a3a29b5b | 33 | |
cmulady | 2:2eb0a3a29b5b | 34 | private: |
cmulady | 2:2eb0a3a29b5b | 35 | Serial* ir_serial; |
cmulady | 2:2eb0a3a29b5b | 36 | PwmOut* ir_pwm; |
cmulady | 3:823708586b3e | 37 | char* packet_buffer_out; |
cmulady | 3:823708586b3e | 38 | char* packet_buffer_in; |
cmulady | 2:2eb0a3a29b5b | 39 | |
cmulady | 2:2eb0a3a29b5b | 40 | }; |
cmulady | 2:2eb0a3a29b5b | 41 | |
cmulady | 2:2eb0a3a29b5b | 42 | |
cmulady | 2:2eb0a3a29b5b | 43 | |
cmulady | 2:2eb0a3a29b5b | 44 | |
cmulady | 2:2eb0a3a29b5b | 45 | |
cmulady | 2:2eb0a3a29b5b | 46 | |
cmulady | 2:2eb0a3a29b5b | 47 | |
cmulady | 2:2eb0a3a29b5b | 48 | |
cmulady | 0:556f9be6047d | 49 | #endif |