API reference
ctsgen3.spi.spi
FPS = 3.75
module-attribute
Current FPS of this firmware version
PIXEL_HEIGHT = 15
module-attribute
Thermal image pixel height.
PIXEL_WIDTH = 20
module-attribute
Thermal image pixel width.
MAX_NUM_DETECTIONS = 21
module-attribute
Maximum number of detections
CvDetection
CV algorithm outputs for each detected heat blob.
Source code in src/ctsgen3/spi/spi.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
SpiThermalPacket
SPI bulk data thermal frame packet.
Source code in src/ctsgen3/spi/spi.py
59 60 61 62 63 64 65 66 67 68 | |
SpiMetadataPacket
SPI bulk data metadata packet.
Source code in src/ctsgen3/spi/spi.py
71 72 73 74 75 76 77 78 79 80 | |
SpiCvForegroundPacket
SPI bulk data CV foreground packet.
Source code in src/ctsgen3/spi/spi.py
83 84 85 86 87 88 89 90 91 92 | |
SpiCvDetectionsPacket
SPI bulk data CV detections packet.
Source code in src/ctsgen3/spi/spi.py
95 96 97 98 99 100 101 102 103 104 | |
SpiPacket
Full SpiPacket when all sections are configured via command and control I2C interface.
Source code in src/ctsgen3/spi/spi.py
107 108 109 110 111 112 113 114 115 116 117 118 119 | |
SpiInterface
dataclass
SPI interface class for reading bulk data from CTS Gen3 EVK via FTDI FT4222 I2C/SPI to USB chip.
Source code in src/ctsgen3/spi/spi.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
CRCError
Raised when CRC validation fails in SPI transfer.
Source code in src/ctsgen3/spi/spi.py
168 169 | |
__init__(ft4222_pair, clock=ft4222.SysClock.CLK_80, clock_divider=ft4222.SPIMaster.Clock.DIV_8)
Initialises SpiInterface object.
Configure clock and divider to achieve goal frequency - maximum frequency tested is 10MHz = CLK_80MHz / divdier 8
Polarity, phase and slave select pins are locked.
Source code in src/ctsgen3/spi/spi.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
init_spi()
Initialises FT4222 as a SPI master. Ensure you call this again if you reconfigure the FT4222 in another mode before using other methods.
Raises ft4222.FT4222DeviceError on error.
Source code in src/ctsgen3/spi/spi.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
close_spi()
Close all FT4222 devices in SPI Interface
Source code in src/ctsgen3/spi/spi.py
189 190 191 192 193 194 | |
read_packet()
Reads a SpiPacket from SPI and validates CRCs. Does not wait for GPIO trigger.
Raises ft4222.FT4222DeviceError or CRCError on error.
Returns:
| Name | Type | Description |
|---|---|---|
SpiPacket |
SpiPacket
|
populated packet on success |
Source code in src/ctsgen3/spi/spi.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
read_bulk_data(timeout_ms=0)
Attempt to read a SpiPacket within timeout_ms and checks for CRC errors.
If timeout_ms is 0, which is default, it will hang indefinitely.
Raises ft4222.FT4222DeviceError or CRCError on error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout_ms
|
int
|
sets the read timeout in milliseconds. Value of 0 means there is no timeout. |
0
|
Returns:
| Type | Description |
|---|---|
SpiPacket | None
|
SpiPacket | None: populated packet on success, else none |
Source code in src/ctsgen3/spi/spi.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |