library for implementing ir transmission
XMIT_IR.h@7:01243fe65940, 2012-10-06 (annotated)
- Committer:
- cmulady
- Date:
- Sat Oct 06 17:45:20 2012 +0000
- Revision:
- 7:01243fe65940
- Parent:
- 6:281167565d6d
good stopping point. ir tx works well enough
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 | 7:01243fe65940 | 14 | IRTransmitter(PinName TX, PinName PWM, PinName RX, int data_buff_len, void (*fptr_isr_rx)(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 | 5:ad52a062d494 | 18 | void isr_rx(char data); |
cmulady | 4:55946953c6e3 | 19 | void set_debug_port(Serial* port); |
cmulady | 2:2eb0a3a29b5b | 20 | |
cmulady | 3:823708586b3e | 21 | private: |
cmulady | 3:823708586b3e | 22 | char packet_is_valid(int data_len); |
cmulady | 3:823708586b3e | 23 | void update_packet_buffer(char new_data, int data_len); |
cmulady | 3:823708586b3e | 24 | |
cmulady | 2:2eb0a3a29b5b | 25 | public: |
cmulady | 7:01243fe65940 | 26 | Mail<char,64> ir_rxdata_mailbox; |
cmulady | 5:ad52a062d494 | 27 | |
cmulady | 4:55946953c6e3 | 28 | Serial* debug_port; |
cmulady | 2:2eb0a3a29b5b | 29 | |
cmulady | 2:2eb0a3a29b5b | 30 | private: |
cmulady | 2:2eb0a3a29b5b | 31 | Serial* ir_serial; |
cmulady | 2:2eb0a3a29b5b | 32 | PwmOut* ir_pwm; |
cmulady | 3:823708586b3e | 33 | char* packet_buffer_out; |
cmulady | 3:823708586b3e | 34 | char* packet_buffer_in; |
cmulady | 2:2eb0a3a29b5b | 35 | |
cmulady | 2:2eb0a3a29b5b | 36 | }; |
cmulady | 2:2eb0a3a29b5b | 37 | |
cmulady | 2:2eb0a3a29b5b | 38 | |
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 | 0:556f9be6047d | 45 | #endif |