OutputPacket packets[4];
uint8_t chain_length;
uint8_t current_packet;
+volatile uint8_t trigger_value;
volatile uint8_t packet_state = IDLE;
static uint8_t out_bit;
static uint8_t out_time;
{
while(packet_state!=IDLE) ;
chain_length = 1;
+ packets[0].trigger_position = 0xFF;
return &packets[0];
}
OutputPacket *output_create_chained_packet(void)
{
- ++chain_length;
- return &packets[chain_length-1];
+ uint8_t i = chain_length++;
+ packets[i].trigger_position = 0xFF;
+ return &packets[i];
}
void output_send_packet(void)
return;
current_packet = 0;
+ trigger_value = 0;
packet_state = READY;
}
+uint8_t output_get_trigger(void)
+{
+ return trigger_value;
+}
+
void output_set_power(uint8_t p)
{
if(p==POWER_ON)
else
PORTD &= ~BIT(POLARITY);
+ if(out_bit==packet->trigger_position)
+ trigger_value = packet->trigger_value;
+
out_time = packet->bit_duration;
}
uint8_t repeat_count;
uint8_t repeat_delay;
uint8_t final_delay;
+ uint8_t trigger_position;
+ uint8_t trigger_value;
} OutputPacket;
void output_init(void);
OutputPacket *output_create_packet(void);
OutputPacket *output_create_chained_packet(void);
void output_send_packet(void);
+uint8_t output_get_trigger(void);
void output_set_power(uint8_t);
uint8_t output_is_power_on();
uint8_t output_command(const uint8_t *, uint8_t);