/* Read a field stored at a device register or memory address. 
This routine reads a specified value from a bit field within a 1-Byte device register or memory address. The set bits in the mask parameter determine the field location. For example, if the mask is 30h and the value AFh is stored in the register, the value 2h will be returned. */
uint8_t bus_reg_fieldget(bus_desc_t *bus, uint8_t addr, uint8_t mask)
/* Read a field stored at a device register or memory address. 
This routine reads a specified value from a bit field within a 1-Byte device register or memory address. The set bits in the mask parameter determine the field location. For example, if the mask is 30h and the value AFh is stored in the register, the value 2h will be returned. */
uint8_t bus_reg_fieldget(bus_desc_t *bus, uint8_t addr, uint8_t mask)
{
	uint8_t const value = mask & bus_get(bus, addr);
	return (value / (mask & ~(mask << 1)));
}