module RPicSim::Sim::ClassMethods
These are class methods that you can call on subclasses of {Sim}.
Attributes
A string like “PIC10F322” specifying the PIC device number.
The path to a COF file for the PIC firmware, which was originally passed to the constructor.
A hash that associates our names for pins (like :main_output_pin) to datasheet pin names (like :RB3). These aliases are defined by {ClassDefinitionMethods#def_pin}.
The {ProgramFile} object representing the firmware.
A {VariableSet} that holds information about all the variables that were defined with {ClassDefinitionMethods#def_var def_var}. @api private
Public Instance Methods
Returns a {Label} object if a program label by that name is found. The name is specified in the code that defined the label. If you are using a C compiler, you will probably need to prefix the name with an underscore. @return [Label]
# File lib/rpicsim/sim.rb, line 139 def label(name) program_file.label(name) end
Returns a hash that associates label names as Ruby symbols to {Label} objects.
# File lib/rpicsim/sim.rb, line 131 def labels program_file.labels end
Private Instance Methods
This gets called when a new subclass of PicSim is created.
# File lib/rpicsim/sim.rb, line 146 def inherited(subclass) subclass.instance_eval do @pin_aliases = {} const_set :Shortcuts, Module.new include self::Shortcuts end end
# File lib/rpicsim/sim.rb, line 154 def load_program_file @program_file = ProgramFile.new(@filename, @device) @variable_set = VariableSet.new @variable_set.address_increment = program_file.address_increment @variable_set.def_memory_type :ram, program_file.symbols_in_ram @variable_set.def_memory_type :program_memory, program_file.symbols_in_program_memory @variable_set.def_memory_type :eeprom, program_file.symbols_in_eeprom end