Lecture 16 – A device driver
Jump to navigation
Jump to search
The Nordic chip on the microbit has a temperature sensor that measures the temperature of the processor die in units of 1/4° Celcius. The device consists of an analog circuit that exploits some temperature-dependent property of silicon, together with a dedicated A-to-D converter that digitises a reading. We will aim to write a device driver for the sensor, and provide a function
int get_temp(void)
that can be called from any process to get an up-to-date temperature reading.
Reasons for having a separate device driver process:
- We can manage concurrent access from multiple processes and prevent a new reading being initiated before the previous one is finished.
- We can connect to the interrupt from the device and react