*\r
* Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irsnd.c,v 1.15 2010/06/02 13:18:03 fm Exp $\r
+ * $Id: irsnd.c,v 1.18 2010/06/10 21:24:50 fm Exp $\r
*\r
* This program is free software; you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
#define IRSND_FREQ_56_KHZ (uint8_t) ((F_CPU / 56000 / 2) - 1)\r
#define IRSND_FREQ_455_KHZ (uint8_t) ((F_CPU / 455000 / 2) - 1)\r
\r
+#define FDC1_START_BIT_PULSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PULSE_TIME + 0.5)\r
+#define FDC1_START_BIT_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PAUSE_TIME + 0.5)\r
+#define FDC1_PULSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_PULSE_TIME + 0.5)\r
+#define FDC1_1_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_1_PAUSE_TIME + 0.5)\r
+#define FDC1_0_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_0_PAUSE_TIME + 0.5)\r
+#define FDC1_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * FDC1_FRAME_REPEAT_PAUSE_TIME + 0.5) // use uint16_t!\r
+\r
static volatile uint8_t irsnd_busy;\r
static volatile uint8_t irsnd_protocol;\r
static volatile uint8_t irsnd_buffer[6];\r
\r
\r
uint8_t\r
-irsnd_send_data (IRMP_DATA * irmp_data_p)\r
+irsnd_send_data (IRMP_DATA * irmp_data_p, uint8_t do_wait)\r
{\r
#if IRSND_SUPPORT_RECS80_PROTOCOL == 1\r
static uint8_t toggle_bit_recs80;\r
uint16_t address;\r
uint16_t command;\r
\r
- while (irsnd_busy)\r
+ if (do_wait)\r
+ {\r
+ while (irsnd_busy)\r
+ {\r
+ // do nothing;\r
+ }\r
+ }\r
+ else if (irsnd_busy)\r
{\r
- ;\r
+ return (FALSE);\r
}\r
\r
irsnd_protocol = irmp_data_p->protocol;\r
irsnd_busy = TRUE;\r
break;\r
}\r
+#endif\r
+#if IRSND_SUPPORT_FDC1_PROTOCOL == 1\r
+ case IRMP_FDC1_PROTOCOL:\r
+ {\r
+ address = bitsrevervse (irmp_data_p->address, FDC1_ADDRESS_LEN);\r
+ command = bitsrevervse (irmp_data_p->command, FDC1_COMMAND_LEN);\r
+\r
+ irsnd_buffer[0] = (address & 0xFF00) >> 8; // AAAAAAAA\r
+ irsnd_buffer[1] = (address & 0x00FF); // AAAAAAAA\r
+ irsnd_buffer[2] = 0; // 00000000\r
+ irsnd_buffer[3] = (command & 0x0FE0) >> 5; // 0CCCCCCC\r
+ irsnd_buffer[4] = ((command & 0x001F) << 3) | 0x07; // CCCCC111\r
+ irsnd_busy = TRUE;\r
+ break;\r
+ }\r
#endif\r
default:\r
{\r
irsnd_set_freq (IRSND_FREQ_36_KHZ);\r
break;\r
}\r
+#endif\r
+#if IRSND_SUPPORT_FDC1_PROTOCOL == 1\r
+ case IRMP_FDC1_PROTOCOL:\r
+ {\r
+ startbit_pulse_len = FDC1_START_BIT_PULSE_LEN;\r
+ startbit_pause_len = FDC1_START_BIT_PAUSE_LEN;\r
+ complete_data_len = FDC1_COMPLETE_DATA_LEN;\r
+ pulse_1_len = FDC1_PULSE_LEN;\r
+ pause_1_len = FDC1_1_PAUSE_LEN;\r
+ pulse_0_len = FDC1_PULSE_LEN;\r
+ pause_0_len = FDC1_0_PAUSE_LEN;\r
+ has_stop_bit = FDC1_STOP_BIT;\r
+ n_auto_repetitions = 1; // 1 frame\r
+ auto_repetition_pause_len = 0;\r
+ repeat_frame_pause_len = FDC1_FRAME_REPEAT_PAUSE_LEN;\r
+ irsnd_set_freq (IRSND_FREQ_38_KHZ);\r
+ break;\r
+ }\r
#endif\r
default:\r
{\r
#if IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
case IRMP_BANG_OLUFSEN_PROTOCOL:\r
#endif\r
+#if IRSND_SUPPORT_NEC_PROTOCOL == 1\r
+ case IRMP_FDC1_PROTOCOL:\r
+#endif\r
\r
\r
#if IRSND_SUPPORT_SIRCS_PROTOCOL == 1 || IRSND_SUPPORT_NEC_PROTOCOL == 1 || IRSND_SUPPORT_SAMSUNG_PROTOCOL == 1 || IRSND_SUPPORT_MATSUSHITA_PROTOCOL == 1 || \\r
IRSND_SUPPORT_RECS80_PROTOCOL == 1 || IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 || IRSND_SUPPORT_DENON_PROTOCOL == 1 || IRSND_SUPPORT_NUBERT_PROTOCOL == 1 || \\r
- IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
+ IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 || IRSND_SUPPORT_FDC1_PROTOCOL == 1\r
{\r
if (pulse_counter == 0)\r
{\r
\r
irsnd_init ();\r
\r
- (void) irsnd_send_data (&irmp_data);\r
+ (void) irsnd_send_data (&irmp_data, TRUE);\r
\r
while (irsnd_busy)\r
{\r