Are there resources for learning to write drivers?
A good driver encapsulates the capabilities of the hardware and makes these available to the OS/applications in a natural way.

How best to do this, depends a lot on which operating system you're targetting and what sort of hardware the driver is for.

My experience is all with Linux and small custom real-time OSen.

For Linux, I'd recommend reading Linux Device Drivers. It's give a good introduction to the different flavours of Linux drivers and the abstractions the operating system provides for them.

Devices like serial ports where data is read sequentially are usually handled by character device drivers with a device node in userspace for applications to read from. cat can read from these.

Random access devices like flash storage and hard disks are handled by block devices. dd can access these. For a good example, have a look at the Linux MTD system.

Drivers which do low level fiddling with hardware will almost certainly need to be implemented in kernel space. You might choose to make a runtime loadable kernel module or to place your code in statically in the linux kernel.

Drivers which build on top of existing generic drivers, like USB, may be written in userspace. Using, for example, libusb.