library for implementing ir transmission
XMIT_IR.h@5:ad52a062d494, 2012-10-06 (annotated)
- Committer:
- cmulady
- Date:
- Sat Oct 06 14:40:38 2012 +0000
- Revision:
- 5:ad52a062d494
- Parent:
- 4:55946953c6e3
- Child:
- 6:281167565d6d
middle of trying to add new feature - may not work
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 | 5:ad52a062d494 | 20 | void isr_tx(); |
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 | 3:823708586b3e | 26 | |
cmulady | 2:2eb0a3a29b5b | 27 | public: |
cmulady | 5:ad52a062d494 | 28 | Mail<char,32> ir_rxdata_mailbox; |
cmulady | 5:ad52a062d494 | 29 | Mail<char,32> ir_txdata_mailbox; |
cmulady | 5:ad52a062d494 | 30 | |
cmulady | 4:55946953c6e3 | 31 | Serial* debug_port; |
cmulady | 2:2eb0a3a29b5b | 32 | |
cmulady | 2:2eb0a3a29b5b | 33 | private: |
cmulady | 2:2eb0a3a29b5b | 34 | Serial* ir_serial; |
cmulady | 2:2eb0a3a29b5b | 35 | PwmOut* ir_pwm; |
cmulady | 3:823708586b3e | 36 | char* packet_buffer_out; |
cmulady | 3:823708586b3e | 37 | char* packet_buffer_in; |
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 | 2:2eb0a3a29b5b | 45 | |
cmulady | 2:2eb0a3a29b5b | 46 | |
cmulady | 2:2eb0a3a29b5b | 47 | |
cmulady | 0:556f9be6047d | 48 | #endif |