library for implementing ir transmission
XMIT_IR.h@3:823708586b3e, 2012-10-06 (annotated)
- Committer:
- cmulady
- Date:
- Sat Oct 06 11:34:30 2012 +0000
- Revision:
- 3:823708586b3e
- Parent:
- 2:2eb0a3a29b5b
- Child:
- 4:55946953c6e3
stack memory error somewhere
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 | 2:2eb0a3a29b5b | 14 | IRTransmitter(PinName TX, PinName PWM, PinName RX, int data_buff_len, void (*fptr)(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 | 2:2eb0a3a29b5b | 19 | void isr(char data); |
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 | 2:2eb0a3a29b5b | 26 | Mail<char,64> ir_data_mailbox; |
cmulady | 2:2eb0a3a29b5b | 27 | |
cmulady | 2:2eb0a3a29b5b | 28 | private: |
cmulady | 2:2eb0a3a29b5b | 29 | Serial* ir_serial; |
cmulady | 2:2eb0a3a29b5b | 30 | PwmOut* ir_pwm; |
cmulady | 3:823708586b3e | 31 | char* packet_buffer_out; |
cmulady | 3:823708586b3e | 32 | char* packet_buffer_in; |
cmulady | 2:2eb0a3a29b5b | 33 | |
cmulady | 2:2eb0a3a29b5b | 34 | }; |
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 | 0:556f9be6047d | 43 | #endif |