Microchip® Advanced Software Framework

sensor_bus.c File Reference

Sensor API Platform Bus Interfaces.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "conf_sensors.h"
#include "sensor_bus.h"

Functions

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. More...
 
void bus_reg_fieldset (bus_desc_t *bus, uint8_t addr, uint8_t mask, uint8_t value)
 Write a field stored at a device register or memory address. More...
 

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.

Sensor Platform Board ConfigurationThis 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.

Parameters
busAn initialized bus interface descriptor.
addrThe device register or memory address.
maskThe mask of the field to set.
Returns
The value stored in the register or memory field.

References bus_get().

void bus_reg_fieldset ( bus_desc_t bus,
uint8_t  addr,
uint8_t  mask,
uint8_t  value 
)

Write a field stored at a device register or memory address.

This routine writes a specified value to 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 is 2h, the value 20h will be bitwise logically OR'd into the 1-Byte register value after clearing the bit values in the field.

Parameters
busAn initialized bus interface descriptor.
addrThe device register or memory address.
maskThe mask of the field to set.
valueThe value of the field to set.
Returns
Nothing

References bus_get(), and bus_put().