csegment.cls

来自「Cypress ez-usb an2131的.hex固件程序文件下载程序」· CLS 代码 · 共 58 行

CLS
58
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CSegment"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
' EZ-USB DownloadHex Example
' copyright (c) 2001 Cypress Semiconductor


'local variable(s) to hold property value(s)
Private mvarAddress As Long
Private mvarIndex As Integer
Private Segment() As Byte
Public HexAddress As String

Public Sub Init(cnt As Long)
    ReDim Segment(cnt - 1)
    mvarIndex = 0
End Sub

Public Sub PutByte(ByVal vData As Byte)
    Segment(mvarIndex) = vData
    mvarIndex = mvarIndex + 1
End Sub

Public Function GetByte(ByVal index As Integer) As Byte
    GetByte = Segment(index)
End Function
Public Property Let Address(ByVal vData As Long)
    mvarAddress = vData
    HexAddress = Hex(vData)
End Property

Public Property Get Address() As Long
    Address = mvarAddress
End Property

Public Property Get SegmentSize() As Long
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.SegmentSize
    SegmentSize = UBound(Segment) + 1 ' due to zero-based array
End Property

Public Sub Grow(ByVal cnt As Integer)
    ReDim Preserve Segment(UBound(Segment) + cnt)
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?