library for implementing ir transmission
XMIT_IR.h
- Committer:
- cmulady
- Date:
- 2012-10-06
- Revision:
- 6:281167565d6d
- Parent:
- 5:ad52a062d494
- Child:
- 7:01243fe65940
File content as of revision 6:281167565d6d:
#ifndef MBED_XMIT_IR_H #define MBED_XMIT_IR_H #include "mbed.h" #include "rtos.h" #define ASCII_ETX 0x03 #define ASCII_STX 0x02 class IRTransmitter { public: IRTransmitter(PinName TX, PinName PWM, PinName RX, int data_buff_len, void (*fptr_isr_rx)(void), void (*fptr_isr_tx)(void)); ~IRTransmitter(); void MakePacket(char* data,int len); char ReadPacket(char* data, int len); void isr_uartrx(void); void isr_rx(char data); char isr_tx(void); void set_debug_port(Serial* port); private: char packet_is_valid(int data_len); void update_packet_buffer(char new_data, int data_len); void mail_tx_packet(char data); public: Mail<char,32> ir_rxdata_mailbox; Mail<char,32> ir_txdata_mailbox; Serial* debug_port; private: Serial* ir_serial; PwmOut* ir_pwm; char* packet_buffer_out; char* packet_buffer_in; }; #endif