A spin–orbit torque device for sensing three-dimensional magnetic fields