static void write_reg(unsigned char reg, unsigned char wr_data)
{
+ leds_lock();
// Select register address.
ADDR_PORT &= ~ADDR_PORT_MASK;
ADDR_PORT |= reg;
// Set register data port as input again.
DATA_PORT = DATA_PORT_MASK;
+ leds_unlock();
}
static unsigned char read_reg(unsigned char reg)
{
+ leds_lock();
// Select register address.
ADDR_PORT &= ~ADDR_PORT_MASK;
ADDR_PORT |= reg;
IOR = 1;
NICE = 1;
+ leds_unlock();
return reg;
}