Expand description
Provides userspace with access to sound_pressure sensors.
§Userspace Interface
§subscribe System Call
The subscribe system call supports the single subscribe_number zero,
which is used to provide a callback that will return back the result of
a sound_pressure sensor reading.
The subscribecall return codes indicate the following:
Ok(()): the callback been successfully been configured.ENOSUPPORT: Invalid allow_num.NOMEM: No sufficient memory available.INVAL: Invalid address of the buffer or other error.
§command System Call
The command system call support one argument cmd which is used to specify the specific
operation, currently the following cmd’s are supported:
0: check whether the driver exist1: read the sound_pressure
The possible return from the ‘command’ system call indicates the following:
Ok(()): The operation has been successful.BUSY: The driver is busy.ENOSUPPORT: Invalidcmd.NOMEM: No sufficient memory available.INVAL: Invalid address of the buffer or other error.
§Usage
You need a device that provides the hil::sensors::SoundPressure trait.
ⓘ
let grant_cap = create_capability!(capabilities::MemoryAllocationCapability);
let grant_sound_pressure = board_kernel.create_grant(&grant_cap);
let temp = static_init!(
capsules::sound_pressure::SoundPressureSensor<'static>,
capsules::sound_pressure::SoundPressureSensor::new(si7021,
board_kernel.create_grant(&grant_cap)));
kernel::hil::sensors::SoundPressure::set_client(si7021, temp);