Logo Search packages:      
Sourcecode: odyssey version File versions

Device * PicDevice::load ( char *  name  )  [static]

Creates an instance of a PIC device from its name. This function is called from Device::load and selects the appropriate Pic16Device subclass to instantiate. This allows for efficient implementation of different PIC programming algorithms.

name The name of the device (case sensitive).
Return values:
NULL if the device is unknown.
Device An instance of a subclass of Device representing the device given by the name parameter.

Reimplemented from Device.

Definition at line 53 of file PicDevice.cxx.

References Util::regex_match().

Referenced by Device::load().

      if(pic_config == NULL)
            pic_config = new ConfigFile("pic.conf", PACKAGE, DATADIR "/pic.conf");

      if(Util::regex_match("^PIC16F87[3467]A", name)) {
            return new Pic16f87xADevice(name);
      } else if(Util::regex_match("^PIC16F8", name) ||
               (strcmp(name, "PIC16C84") == 0)) {
            return new Pic16f8xxDevice(name);
      } else if(Util::regex_match("^PIC16F7[3467]$", name)) {
            return new Pic16f7xDevice(name);
      } else if(Util::regex_match("^PIC16F6.*", name)) {
            return new Pic16f6xxDevice(name);
      } else if(Util::regex_match("^PIC12F6.*", name)) {
            return new Pic12f6xxDevice(name);
      } else if(Util::regex_match("^PIC16.*", name)) {
            return new Pic16Device(name);
      } else if(Util::regex_match("^PIC18.*", name)) {
            return new Pic18Device(name);
      return NULL;

Generated by  Doxygen 1.6.0   Back to index