/*
 * buzzer.c
 *
 *  Created on: 09-10-2014
 *      Author: Krzysztof Jakubczyk
 */

#include "tdefs.h"
#include "misc.h"

#include "led.h"

int buzzer_initlog(void *arguments, void *logic)
{
	struct led_args *args = (struct led_args *)arguments;
	struct led_logic *log = (struct led_logic *)logic;

	log->in_ptr = log_manager.nets_data + (args->io.in  >> 3);
	log->in_bit_no = args->io.in & 0x07;
	log->blink_in_ptr = log_manager.nets_data + (args->io.blink_in  >> 3);
	log->blink_in_bit_no = args->io.blink_in & 0x07;
	log->clr_ptr = log_manager.nets_data + (args->io.clr_in >> 3);
	log->clr_bit_no = args->io.clr_in & 0x07;

	if(log->in_ptr >= (log_manager.nets_data+sizeof(log_manager.nets_data)))
		return -1;

	if(log->clr_ptr >= (log_manager.nets_data+sizeof(log_manager.nets_data)))
		return -1;

	if(log->blink_in_ptr >= (log_manager.nets_data+sizeof(log_manager.nets_data)))
		return -1;

	args->params.led_num=BUZZER_LED_NUM;

	return 0;
}

