Its a good Idea, I have done that myself upto a limit. I have made a common library for LCD16x2,Graphic LCD 128x64, SD Card, Software I2c and SPI, software UART, for Atmegas, PICs & 8051's. The difficult part is the varying register names across different architecture, for example even the PIC16f and PIC18f although from the same manufacturer, have completely different sets of registers. I have tried to solve this problem my using header files where I have #defined all the registers with alias names. But this can go on and on..besides making these interrupt based is completely a different ball game. May be a utility has to be made where you setup a microcontroller and appropriate settings and all the registers and pinning is auto generated code (header files). PSOC from Cypress have been doing it this way and I feel is the best thing possible to tackle the problem. Hope you get pointers from this to problems that you may encounter.