hardsploit_gui 2.3 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -22
- data/Rakefile +1 -1
- data/bin/hardsploit_gui +3 -3
- data/lib/Firmwares/FPGA/I2C/I2C_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_I2C_INTERACT.rpd +0 -0
- data/lib/Firmwares/FPGA/PARALLEL/NO_MUX_PARALLEL_MEMORY/HARDSPLOIT_FIRMWARE_FPGA_NO_MUX_PARALLEL_MEMORY.rpd +0 -0
- data/lib/Firmwares/FPGA/SPI/SPI_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SPI_INTERACT.rpd +0 -0
- data/lib/Firmwares/FPGA/SPI/SPI_SNIFFER/HARDSPLOIT_FIRMWARE_FPGA_SPI_SNIFFER.rpd +0 -0
- data/lib/Firmwares/FPGA/SWD/SWD_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_SWD_INTERACT.rpd +0 -0
- data/lib/Firmwares/FPGA/UART/UART_INTERACT/HARDSPLOIT_FIRMWARE_FPGA_UART_INTERACT.rpd +0 -0
- data/lib/Firmwares/FPGA/VersionFPGA.rb +5 -5
- data/lib/Firmwares/UC/VersionUC.rb +12 -12
- data/lib/HardsploitAPI/Core/HardsploitAPI.rb +210 -210
- data/lib/HardsploitAPI/Core/HardsploitAPI_CONSTANT.rb +150 -150
- data/lib/HardsploitAPI/Core/HardsploitAPI_ERROR.rb +109 -109
- data/lib/HardsploitAPI/Core/HardsploitAPI_FIRMWARE.rb +305 -305
- data/lib/HardsploitAPI/Core/HardsploitAPI_PROGRESS.rb +28 -28
- data/lib/HardsploitAPI/Core/HardsploitAPI_USB_COMMUNICATION.rb +166 -166
- data/lib/HardsploitAPI/Modules/I2C/HardsploitAPI_I2C.rb +356 -356
- data/lib/HardsploitAPI/Modules/NO_MUX_PARALLEL_MEMORY/HardsploitAPI_NO_MUX_PARALLEL_MEMORY.rb +206 -206
- data/lib/HardsploitAPI/Modules/NRF24L01/HardsploitAPI_NRF24L01.rb +306 -306
- data/lib/HardsploitAPI/Modules/SPI/HardsploitAPI_SPI.rb +340 -340
- data/lib/HardsploitAPI/Modules/SPI_SNIFFER/HardsploitAPI_SPI_SNIFFER.rb +83 -83
- data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD.rb +367 -367
- data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD_DEBUG.rb +89 -89
- data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD_MEM_AP.rb +61 -61
- data/lib/HardsploitAPI/Modules/SWD/HardsploitAPI_SWD_STM32.rb +121 -121
- data/lib/HardsploitAPI/Modules/TEST/HardsploitAPI_TEST_INTERACT.rb +98 -98
- data/lib/HardsploitAPI/Modules/UART/HardsploitAPI_UART.rb +196 -196
- data/lib/Hardsploit_gui.rb +96 -96
- data/lib/LICENSE.txt +674 -674
- data/lib/README.md +22 -22
- data/lib/TRADEMARK +2 -2
- data/lib/class/Chip_editor.rb +304 -304
- data/lib/class/Chip_management.rb +496 -496
- data/lib/class/Command_editor.rb +216 -216
- data/lib/class/Command_table.rb +233 -233
- data/lib/class/Console.rb +26 -26
- data/lib/class/ErrorMsg.rb +312 -312
- data/lib/class/Export.rb +140 -140
- data/lib/class/Export_manager.rb +124 -124
- data/lib/class/Firmware.rb +70 -70
- data/lib/class/Generic_commands.rb +260 -260
- data/lib/class/{i2c → I2C}/I2c_command.rb +51 -51
- data/lib/class/{i2c → I2C}/I2c_export.rb +95 -95
- data/lib/class/{i2c → I2C}/I2c_import.rb +117 -117
- data/lib/class/{i2c → I2C}/I2c_scanner.rb +114 -114
- data/lib/class/{i2c → I2C}/I2c_settings.rb +148 -148
- data/lib/class/Import.rb +193 -193
- data/lib/class/{parallel → PARALLEL}/Parallel_export.rb +118 -118
- data/lib/class/{parallel → PARALLEL}/Parallel_import.rb +113 -113
- data/lib/class/{parallel → PARALLEL}/Parallel_settings.rb +81 -81
- data/lib/class/Progress_bar.rb +32 -32
- data/lib/class/{spi → SPI}/Spi_export.rb +108 -108
- data/lib/class/{spi → SPI}/Spi_import.rb +159 -159
- data/lib/class/{spi → SPI}/Spi_settings.rb +108 -108
- data/lib/class/{spi → SPI}/Spi_sniffer.rb +101 -101
- data/lib/class/Signal_mapper.rb +120 -120
- data/lib/class/Wire_helper.rb +230 -230
- data/lib/class/swd/Swd.rb +125 -125
- data/lib/class/swd/Swd_scanner.rb +121 -121
- data/lib/class/swd/Swd_settings.rb +76 -76
- data/lib/class/uart/Uart_baudrate.rb +62 -62
- data/lib/class/uart/Uart_console.rb +115 -115
- data/lib/class/uart/Uart_settings.rb +102 -102
- data/lib/db/associations.rb +138 -138
- data/lib/db/database.rb +4 -4
- data/lib/db/development.sqlite3 +0 -0
- data/lib/db/migrate/004_create_manufacturers.rb +13 -13
- data/lib/db/migrate/005_create_packages.rb +13 -13
- data/lib/db/migrate/006_create_chip_types.rb +11 -11
- data/lib/db/migrate/007_create_buses.rb +11 -11
- data/lib/db/migrate/008_create_signals.rb +14 -14
- data/lib/db/migrate/009_create_chips.rb +25 -25
- data/lib/db/migrate/010_create_commands.rb +21 -21
- data/lib/db/migrate/011_create_bytes.rb +19 -19
- data/lib/db/migrate/012_create_i2c_settings.rb +21 -21
- data/lib/db/migrate/013_create_spi_settings.rb +26 -26
- data/lib/db/migrate/014_create_parallel_settings.rb +21 -21
- data/lib/db/migrate/015_create_pins.rb +19 -19
- data/lib/db/migrate/016_create_uses.rb +17 -17
- data/lib/db/migrate/017_create_swd_settings.rb +19 -19
- data/lib/db/migrate/018_create_uart_settings.rb +22 -22
- data/lib/db/schema.rb +157 -157
- data/lib/db/seeds.rb +161 -161
- data/lib/gui/gui_chip_editor.rb +349 -349
- data/lib/gui/gui_chip_management.rb +377 -377
- data/lib/gui/gui_command_editor.rb +219 -219
- data/lib/gui/gui_export.rb +132 -132
- data/lib/gui/gui_export_manager.rb +93 -93
- data/lib/gui/gui_generic_commands.rb +202 -202
- data/lib/gui/gui_generic_export.rb +164 -164
- data/lib/gui/gui_generic_import.rb +142 -142
- data/lib/gui/gui_i2c_command.rb +116 -116
- data/lib/gui/gui_i2c_settings.rb +230 -230
- data/lib/gui/gui_import.rb +131 -131
- data/lib/gui/gui_parallel_settings.rb +195 -195
- data/lib/gui/gui_progress_bar.rb +85 -85
- data/lib/gui/gui_signal_mapper.rb +121 -121
- data/lib/gui/gui_signal_scanner.rb +146 -146
- data/lib/gui/gui_spi_import.rb +126 -126
- data/lib/gui/gui_spi_settings.rb +313 -313
- data/lib/gui/gui_spi_sniffer.rb +112 -112
- data/lib/gui/gui_swd_settings.rb +166 -166
- data/lib/gui/gui_uart_baudrate.rb +114 -114
- data/lib/gui/gui_uart_console.rb +164 -164
- data/lib/gui/gui_uart_settings.rb +243 -243
- data/lib/gui/gui_wire_helper.rb +99 -99
- data/lib/gui_designer/gui_chip_editor.ui +549 -549
- data/lib/gui_designer/gui_chip_management.ui +886 -886
- data/lib/gui_designer/gui_command_editor.ui +350 -350
- data/lib/gui_designer/gui_export.ui +171 -171
- data/lib/gui_designer/gui_export_manager.ui +115 -115
- data/lib/gui_designer/gui_generic_commands.ui +342 -342
- data/lib/gui_designer/gui_generic_export.ui +202 -202
- data/lib/gui_designer/gui_generic_import.ui +165 -165
- data/lib/gui_designer/gui_i2c_command.ui +148 -148
- data/lib/gui_designer/gui_i2c_settings.ui +292 -292
- data/lib/gui_designer/gui_import.ui +168 -168
- data/lib/gui_designer/gui_parallel_settings.ui +247 -247
- data/lib/gui_designer/gui_progress_bar.ui +86 -86
- data/lib/gui_designer/gui_signal_mapper.ui +179 -179
- data/lib/gui_designer/gui_signal_scanner.ui +261 -261
- data/lib/gui_designer/gui_spi_settings.ui +446 -446
- data/lib/gui_designer/gui_spi_sniffer.ui +156 -156
- data/lib/gui_designer/gui_swd_settings.ui +189 -189
- data/lib/gui_designer/gui_uart_baudrate.ui +161 -161
- data/lib/gui_designer/gui_uart_console.ui +284 -284
- data/lib/gui_designer/gui_uart_settings.ui +280 -280
- data/lib/gui_designer/gui_wire_helper.ui +117 -117
- data/lib/images/search.png +0 -0
- data/lib/logs/error.log +0 -63
- data/lib/models/bus.rb +19 -19
- data/lib/models/byte.rb +29 -29
- data/lib/models/chip.rb +41 -41
- data/lib/models/chip_type.rb +14 -14
- data/lib/models/command.rb +20 -20
- data/lib/models/i2c_setting.rb +41 -41
- data/lib/models/manufacturer.rb +14 -14
- data/lib/models/package.rb +26 -26
- data/lib/models/parallel_setting.rb +37 -37
- data/lib/models/pin.rb +14 -14
- data/lib/models/signall.rb +20 -20
- data/lib/models/spi_setting.rb +67 -67
- data/lib/models/swd_setting.rb +25 -25
- data/lib/models/uart_setting.rb +52 -52
- data/lib/models/use.rb +6 -6
- data/lib/startHardsploit.rb +10 -10
- metadata +14 -14
data/lib/models/chip_type.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
class ChipType < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :name,
|
4
|
-
length: {
|
5
|
-
in: 2..20,
|
6
|
-
message: "must be between 2 and 20 characters (chip type)"
|
7
|
-
},
|
8
|
-
presence: true,
|
9
|
-
uniqueness: true
|
10
|
-
|
11
|
-
# Associations
|
12
|
-
has_many :chips,
|
13
|
-
dependent: :destroy
|
14
|
-
end
|
1
|
+
class ChipType < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :name,
|
4
|
+
length: {
|
5
|
+
in: 2..20,
|
6
|
+
message: "must be between 2 and 20 characters (chip type)"
|
7
|
+
},
|
8
|
+
presence: true,
|
9
|
+
uniqueness: true
|
10
|
+
|
11
|
+
# Associations
|
12
|
+
has_many :chips,
|
13
|
+
dependent: :destroy
|
14
|
+
end
|
data/lib/models/command.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
class Command < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :name,
|
4
|
-
length: {
|
5
|
-
in: 2..25,
|
6
|
-
wrong_length: "Name needs to be between 2 and 25 characters"
|
7
|
-
},
|
8
|
-
presence: true
|
9
|
-
validates :description,
|
10
|
-
length: {
|
11
|
-
maximum: 140,
|
12
|
-
too_long: "%{count} characters maximum for the description"
|
13
|
-
}
|
14
|
-
|
15
|
-
# Associations
|
16
|
-
has_many :bytes,
|
17
|
-
dependent: :destroy
|
18
|
-
belongs_to :chip
|
19
|
-
belongs_to :bus
|
20
|
-
end
|
1
|
+
class Command < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :name,
|
4
|
+
length: {
|
5
|
+
in: 2..25,
|
6
|
+
wrong_length: "Name needs to be between 2 and 25 characters"
|
7
|
+
},
|
8
|
+
presence: true
|
9
|
+
validates :description,
|
10
|
+
length: {
|
11
|
+
maximum: 140,
|
12
|
+
too_long: "%{count} characters maximum for the description"
|
13
|
+
}
|
14
|
+
|
15
|
+
# Associations
|
16
|
+
has_many :bytes,
|
17
|
+
dependent: :destroy
|
18
|
+
belongs_to :chip
|
19
|
+
belongs_to :bus
|
20
|
+
end
|
data/lib/models/i2c_setting.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
class I2cSetting < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :address_w,
|
4
|
-
format: {
|
5
|
-
with: /[A-Fa-f0-9]{2}/,
|
6
|
-
message: "Write address only allow hexadecimal values"
|
7
|
-
}
|
8
|
-
validates :address_r,
|
9
|
-
format: {
|
10
|
-
with: /[A-Fa-f0-9]{2}/,
|
11
|
-
message: "Read address only allow hexadecimal values"
|
12
|
-
}
|
13
|
-
validates :frequency,
|
14
|
-
numericality: {
|
15
|
-
only_integer: true,
|
16
|
-
greater_than_or_equal_to: 100,
|
17
|
-
less_than_or_equal_to: 1000,
|
18
|
-
allow_nil: true
|
19
|
-
}
|
20
|
-
validates :write_page_latency,
|
21
|
-
numericality: {
|
22
|
-
only_integer: true,
|
23
|
-
greater_than_or_equal_to: 0,
|
24
|
-
allow_nil: true
|
25
|
-
}
|
26
|
-
validates :page_size,
|
27
|
-
numericality: {
|
28
|
-
only_integer: true,
|
29
|
-
greater_than_or_equal_to: 0,
|
30
|
-
allow_nil: true
|
31
|
-
}
|
32
|
-
validates :total_size,
|
33
|
-
numericality: {
|
34
|
-
only_integer: true,
|
35
|
-
greater_than_or_equal_to: 0,
|
36
|
-
allow_nil: true
|
37
|
-
}
|
38
|
-
|
39
|
-
# Associations
|
40
|
-
belongs_to :chip
|
41
|
-
end
|
1
|
+
class I2cSetting < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :address_w,
|
4
|
+
format: {
|
5
|
+
with: /[A-Fa-f0-9]{2}/,
|
6
|
+
message: "Write address only allow hexadecimal values"
|
7
|
+
}
|
8
|
+
validates :address_r,
|
9
|
+
format: {
|
10
|
+
with: /[A-Fa-f0-9]{2}/,
|
11
|
+
message: "Read address only allow hexadecimal values"
|
12
|
+
}
|
13
|
+
validates :frequency,
|
14
|
+
numericality: {
|
15
|
+
only_integer: true,
|
16
|
+
greater_than_or_equal_to: 100,
|
17
|
+
less_than_or_equal_to: 1000,
|
18
|
+
allow_nil: true
|
19
|
+
}
|
20
|
+
validates :write_page_latency,
|
21
|
+
numericality: {
|
22
|
+
only_integer: true,
|
23
|
+
greater_than_or_equal_to: 0,
|
24
|
+
allow_nil: true
|
25
|
+
}
|
26
|
+
validates :page_size,
|
27
|
+
numericality: {
|
28
|
+
only_integer: true,
|
29
|
+
greater_than_or_equal_to: 0,
|
30
|
+
allow_nil: true
|
31
|
+
}
|
32
|
+
validates :total_size,
|
33
|
+
numericality: {
|
34
|
+
only_integer: true,
|
35
|
+
greater_than_or_equal_to: 0,
|
36
|
+
allow_nil: true
|
37
|
+
}
|
38
|
+
|
39
|
+
# Associations
|
40
|
+
belongs_to :chip
|
41
|
+
end
|
data/lib/models/manufacturer.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
class Manufacturer < ActiveRecord::Base
|
2
|
-
#Validations
|
3
|
-
validates :name,
|
4
|
-
length: {
|
5
|
-
in: 2..25,
|
6
|
-
message: "must be between 2 and 25 characters (manufacturer)"
|
7
|
-
},
|
8
|
-
presence: true,
|
9
|
-
uniqueness: true
|
10
|
-
|
11
|
-
# Associations
|
12
|
-
has_many :chips,
|
13
|
-
dependent: :destroy
|
14
|
-
end
|
1
|
+
class Manufacturer < ActiveRecord::Base
|
2
|
+
#Validations
|
3
|
+
validates :name,
|
4
|
+
length: {
|
5
|
+
in: 2..25,
|
6
|
+
message: "must be between 2 and 25 characters (manufacturer)"
|
7
|
+
},
|
8
|
+
presence: true,
|
9
|
+
uniqueness: true
|
10
|
+
|
11
|
+
# Associations
|
12
|
+
has_many :chips,
|
13
|
+
dependent: :destroy
|
14
|
+
end
|
data/lib/models/package.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
class Package < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :name,
|
4
|
-
length: {
|
5
|
-
in: 2..25,
|
6
|
-
message: "must be between 2 and 25 characters (package)"
|
7
|
-
},
|
8
|
-
presence: true
|
9
|
-
validates :pin_number,
|
10
|
-
numericality: {
|
11
|
-
only_integer: true,
|
12
|
-
greater_than_or_equal_to: 4
|
13
|
-
},
|
14
|
-
presence: true
|
15
|
-
validates :shape,
|
16
|
-
numericality: {
|
17
|
-
only_integer: true,
|
18
|
-
greater_than_or_equal_to: 0,
|
19
|
-
less_than_or_equal_to: 1
|
20
|
-
},
|
21
|
-
presence: true
|
22
|
-
|
23
|
-
# Associations
|
24
|
-
has_many :chips,
|
25
|
-
dependent: :destroy
|
26
|
-
end
|
1
|
+
class Package < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :name,
|
4
|
+
length: {
|
5
|
+
in: 2..25,
|
6
|
+
message: "must be between 2 and 25 characters (package)"
|
7
|
+
},
|
8
|
+
presence: true
|
9
|
+
validates :pin_number,
|
10
|
+
numericality: {
|
11
|
+
only_integer: true,
|
12
|
+
greater_than_or_equal_to: 4
|
13
|
+
},
|
14
|
+
presence: true
|
15
|
+
validates :shape,
|
16
|
+
numericality: {
|
17
|
+
only_integer: true,
|
18
|
+
greater_than_or_equal_to: 0,
|
19
|
+
less_than_or_equal_to: 1
|
20
|
+
},
|
21
|
+
presence: true
|
22
|
+
|
23
|
+
# Associations
|
24
|
+
has_many :chips,
|
25
|
+
dependent: :destroy
|
26
|
+
end
|
@@ -1,37 +1,37 @@
|
|
1
|
-
class ParallelSetting < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :total_size,
|
4
|
-
numericality: {
|
5
|
-
only_integer: true,
|
6
|
-
greater_than_or_equal_to: 0,
|
7
|
-
allow_nil: true
|
8
|
-
}
|
9
|
-
validates :page_size,
|
10
|
-
numericality: {
|
11
|
-
only_integer: true,
|
12
|
-
greater_than_or_equal_to: 0,
|
13
|
-
allow_nil: true
|
14
|
-
}
|
15
|
-
validates :word_size,
|
16
|
-
numericality: {
|
17
|
-
only_integer: true,
|
18
|
-
greater_than_or_equal_to: 0,
|
19
|
-
allow_nil: true
|
20
|
-
}
|
21
|
-
validates :read_latency,
|
22
|
-
numericality: {
|
23
|
-
only_integer: true,
|
24
|
-
greater_than_or_equal_to: 0,
|
25
|
-
less_than_or_equal_to: 1600,
|
26
|
-
allow_nil: true
|
27
|
-
}
|
28
|
-
validates :write_latency,
|
29
|
-
numericality: {
|
30
|
-
only_integer: true,
|
31
|
-
greater_than_or_equal_to: 0,
|
32
|
-
allow_nil: true
|
33
|
-
}
|
34
|
-
|
35
|
-
# Associations
|
36
|
-
belongs_to :chip
|
37
|
-
end
|
1
|
+
class ParallelSetting < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :total_size,
|
4
|
+
numericality: {
|
5
|
+
only_integer: true,
|
6
|
+
greater_than_or_equal_to: 0,
|
7
|
+
allow_nil: true
|
8
|
+
}
|
9
|
+
validates :page_size,
|
10
|
+
numericality: {
|
11
|
+
only_integer: true,
|
12
|
+
greater_than_or_equal_to: 0,
|
13
|
+
allow_nil: true
|
14
|
+
}
|
15
|
+
validates :word_size,
|
16
|
+
numericality: {
|
17
|
+
only_integer: true,
|
18
|
+
greater_than_or_equal_to: 0,
|
19
|
+
allow_nil: true
|
20
|
+
}
|
21
|
+
validates :read_latency,
|
22
|
+
numericality: {
|
23
|
+
only_integer: true,
|
24
|
+
greater_than_or_equal_to: 0,
|
25
|
+
less_than_or_equal_to: 1600,
|
26
|
+
allow_nil: true
|
27
|
+
}
|
28
|
+
validates :write_latency,
|
29
|
+
numericality: {
|
30
|
+
only_integer: true,
|
31
|
+
greater_than_or_equal_to: 0,
|
32
|
+
allow_nil: true
|
33
|
+
}
|
34
|
+
|
35
|
+
# Associations
|
36
|
+
belongs_to :chip
|
37
|
+
end
|
data/lib/models/pin.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
class Pin < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :number,
|
4
|
-
numericality: {
|
5
|
-
only_integer: true,
|
6
|
-
greater_than_or_equal_to: 1,
|
7
|
-
},
|
8
|
-
presence: true
|
9
|
-
|
10
|
-
# Associations
|
11
|
-
belongs_to :chip
|
12
|
-
belongs_to :signall,
|
13
|
-
foreign_key: "signal_id"
|
14
|
-
end
|
1
|
+
class Pin < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :number,
|
4
|
+
numericality: {
|
5
|
+
only_integer: true,
|
6
|
+
greater_than_or_equal_to: 1,
|
7
|
+
},
|
8
|
+
presence: true
|
9
|
+
|
10
|
+
# Associations
|
11
|
+
belongs_to :chip
|
12
|
+
belongs_to :signall,
|
13
|
+
foreign_key: "signal_id"
|
14
|
+
end
|
data/lib/models/signall.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
class Signall < ActiveRecord::Base
|
2
|
-
self.table_name = "signals"
|
3
|
-
|
4
|
-
# Validations
|
5
|
-
validates :name,
|
6
|
-
length: {
|
7
|
-
in: 1..10,
|
8
|
-
wrong_length: "Signal name needs to be between 1 and 10 characters"
|
9
|
-
},
|
10
|
-
presence: true,
|
11
|
-
uniqueness: true
|
12
|
-
|
13
|
-
# Associations
|
14
|
-
has_many :uses,
|
15
|
-
foreign_key: "signal_id"
|
16
|
-
has_many :buses,
|
17
|
-
through: :uses,
|
18
|
-
foreign_key: "signal_id"
|
19
|
-
has_many :pins
|
20
|
-
end
|
1
|
+
class Signall < ActiveRecord::Base
|
2
|
+
self.table_name = "signals"
|
3
|
+
|
4
|
+
# Validations
|
5
|
+
validates :name,
|
6
|
+
length: {
|
7
|
+
in: 1..10,
|
8
|
+
wrong_length: "Signal name needs to be between 1 and 10 characters"
|
9
|
+
},
|
10
|
+
presence: true,
|
11
|
+
uniqueness: true
|
12
|
+
|
13
|
+
# Associations
|
14
|
+
has_many :uses,
|
15
|
+
foreign_key: "signal_id"
|
16
|
+
has_many :buses,
|
17
|
+
through: :uses,
|
18
|
+
foreign_key: "signal_id"
|
19
|
+
has_many :pins
|
20
|
+
end
|
data/lib/models/spi_setting.rb
CHANGED
@@ -1,67 +1,67 @@
|
|
1
|
-
class SpiSetting < ActiveRecord::Base
|
2
|
-
# Validations
|
3
|
-
validates :mode,
|
4
|
-
numericality: {
|
5
|
-
only_integer: true,
|
6
|
-
greater_than_or_equal_to: 0,
|
7
|
-
less_than_or_equal_to: 3,
|
8
|
-
allow_nil: true
|
9
|
-
}
|
10
|
-
validates :write_page_latency,
|
11
|
-
numericality: {
|
12
|
-
only_integer: true,
|
13
|
-
greater_than_or_equal_to: 0,
|
14
|
-
allow_nil: true
|
15
|
-
}
|
16
|
-
validates :command_read,
|
17
|
-
numericality: {
|
18
|
-
only_integer: true,
|
19
|
-
greater_than_or_equal_to: 0,
|
20
|
-
allow_nil: true
|
21
|
-
}
|
22
|
-
validates :command_write,
|
23
|
-
numericality: {
|
24
|
-
only_integer: true,
|
25
|
-
greater_than_or_equal_to: 0,
|
26
|
-
allow_nil: true
|
27
|
-
}
|
28
|
-
validates :command_write_enable,
|
29
|
-
numericality: {
|
30
|
-
only_integer: true,
|
31
|
-
greater_than_or_equal_to: 0,
|
32
|
-
allow_nil: true
|
33
|
-
}
|
34
|
-
validates :command_erase,
|
35
|
-
numericality: {
|
36
|
-
only_integer: true,
|
37
|
-
greater_than_or_equal_to: 0,
|
38
|
-
allow_nil: true
|
39
|
-
}
|
40
|
-
validates :erase_time,
|
41
|
-
numericality: {
|
42
|
-
only_integer: true,
|
43
|
-
greater_than_or_equal_to: 0,
|
44
|
-
allow_nil: true
|
45
|
-
}
|
46
|
-
validates :page_size,
|
47
|
-
numericality: {
|
48
|
-
only_integer: true,
|
49
|
-
greater_than_or_equal_to: 0,
|
50
|
-
allow_nil: true
|
51
|
-
}
|
52
|
-
validates :total_size,
|
53
|
-
numericality: {
|
54
|
-
only_integer: true,
|
55
|
-
greater_than_or_equal_to: 0,
|
56
|
-
allow_nil: true
|
57
|
-
}
|
58
|
-
validates :is_flash,
|
59
|
-
numericality: {
|
60
|
-
only_integer: true,
|
61
|
-
greater_than_or_equal_to: 0,
|
62
|
-
less_than_or_equal_to: 1,
|
63
|
-
allow_nil: true
|
64
|
-
}
|
65
|
-
# Associations
|
66
|
-
belongs_to :chip
|
67
|
-
end
|
1
|
+
class SpiSetting < ActiveRecord::Base
|
2
|
+
# Validations
|
3
|
+
validates :mode,
|
4
|
+
numericality: {
|
5
|
+
only_integer: true,
|
6
|
+
greater_than_or_equal_to: 0,
|
7
|
+
less_than_or_equal_to: 3,
|
8
|
+
allow_nil: true
|
9
|
+
}
|
10
|
+
validates :write_page_latency,
|
11
|
+
numericality: {
|
12
|
+
only_integer: true,
|
13
|
+
greater_than_or_equal_to: 0,
|
14
|
+
allow_nil: true
|
15
|
+
}
|
16
|
+
validates :command_read,
|
17
|
+
numericality: {
|
18
|
+
only_integer: true,
|
19
|
+
greater_than_or_equal_to: 0,
|
20
|
+
allow_nil: true
|
21
|
+
}
|
22
|
+
validates :command_write,
|
23
|
+
numericality: {
|
24
|
+
only_integer: true,
|
25
|
+
greater_than_or_equal_to: 0,
|
26
|
+
allow_nil: true
|
27
|
+
}
|
28
|
+
validates :command_write_enable,
|
29
|
+
numericality: {
|
30
|
+
only_integer: true,
|
31
|
+
greater_than_or_equal_to: 0,
|
32
|
+
allow_nil: true
|
33
|
+
}
|
34
|
+
validates :command_erase,
|
35
|
+
numericality: {
|
36
|
+
only_integer: true,
|
37
|
+
greater_than_or_equal_to: 0,
|
38
|
+
allow_nil: true
|
39
|
+
}
|
40
|
+
validates :erase_time,
|
41
|
+
numericality: {
|
42
|
+
only_integer: true,
|
43
|
+
greater_than_or_equal_to: 0,
|
44
|
+
allow_nil: true
|
45
|
+
}
|
46
|
+
validates :page_size,
|
47
|
+
numericality: {
|
48
|
+
only_integer: true,
|
49
|
+
greater_than_or_equal_to: 0,
|
50
|
+
allow_nil: true
|
51
|
+
}
|
52
|
+
validates :total_size,
|
53
|
+
numericality: {
|
54
|
+
only_integer: true,
|
55
|
+
greater_than_or_equal_to: 0,
|
56
|
+
allow_nil: true
|
57
|
+
}
|
58
|
+
validates :is_flash,
|
59
|
+
numericality: {
|
60
|
+
only_integer: true,
|
61
|
+
greater_than_or_equal_to: 0,
|
62
|
+
less_than_or_equal_to: 1,
|
63
|
+
allow_nil: true
|
64
|
+
}
|
65
|
+
# Associations
|
66
|
+
belongs_to :chip
|
67
|
+
end
|