Raphael Neider schrieb: > Hi, > > I am not sure whether adding special cases for each device/device class > is a good idea. This will easily become unmaintainable, I fear. > If the devices differed only inthe number of ADCs, one could add > something like > #define HASADCON0 1 > #undef HASADCON1
its not only the number that differ, but also the numbering and the bit mask behind the different numbers. For example: first channel is ADC_CHN_1..7 = 0x00..0x07 in the adc.h with missing channel 0x02, on pic18f2550 first channel is ADC_CHN_0 = 0x00 max 13 channels, on pic18f1220 first channel is ADC_CHN0..6 = 0x00..0x06 > to the device headers, provide copies of the adc routines for all > classes and select the correct one from additional defines from within > the device headers, a la > #define adc_close adc_close2 > where adc_close2 is the current adc_close() referencing ADCON0... > > However, if the configuration requirements change even within a device > category, many more defines are required to accomodate for that... > Unfortunately I am not really familiar with ADC on even one of the pic16 > devices to be able to estimate the effort required; any proposals are > welcome. > > @Vangelis: Shall I commit the patch (see previous mail in this thread)? > >> Is it possible to add possible to add a warning in the #else path when >> using a function which is not directly programmed for the give chip? > A preprocessor construct like > #warning my message > should do the trick, but this will trigger a warning only when the > library is built, not when the user builds his/her program... The latter > would require the #warning to reside in at least one ADC header file > (which is doubtlessly a viable option). at least you need to inform the programmer that the lib he is using is not directly made for his device. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sdcc-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sdcc-user
