/* flaneth - flash and ethernet
   Copyright (C) 2007-2012 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
   a BlinkenArea project - http://www.blinkenarea.org/ */

#include <avr/io.h>

#include "bus.h"

// initialize
void BusInit(void)      // (extern)
{
  // address port to output
  BUS_ADDR = 0x00;      // default address
  BUS_ADDR_DDR = 0xFF;  // output

  // data port to input
  BUS_DATA = 0x00;      // pull-ups off
  BUS_DATA_DDR = 0x00;  // input

  // read pin to output
  bit_set(BUS_PORT_nRD, BUS_BIT_nRD);   // nRD to high
  bit_set(BUS_DDR_nRD, BUS_BIT_nRD);    // output

  // write pin to output
  bit_set(BUS_PORT_nWR, BUS_BIT_nWR);   // nWR to high
  bit_set(BUS_DDR_nWR, BUS_BIT_nWR);    // output
}
