Lecture 16 – A device driver

Copyright © 2017–2023 J. M. Spivey
Revision as of 11:44, 2 March 2022 by Mike (talk | contribs) (Created page with "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 cir...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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