Before you start writing a device driver, pause for a moment to consider whether it is really necessary. There are generic device drivers for many common types of device that allow you to interact with hardware directly from user space without having to write a line of kernel code. User space code is certainly easier to write and debug. It is also not covered by the GPL, although I don't feel that is a good reason in itself to do it this way.
They fall into two broad categories: those that you control through files in
sysfs, including GPIO and LEDs, and serial buses that expose a generic interface through a device node, such as I2C.
General Purpose Input/Output (GPIO) is the simplest form of digital interface since ...