-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
amend driver to support flux afe fast pulses
- Loading branch information
Showing
10 changed files
with
360 additions
and
68 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import spidev | ||
|
||
class HMC7044: | ||
def __init__(self): | ||
# self.spi = spidev.SpiDev() | ||
# self.spi.open(2, 0) | ||
# self.spi.mode = 0 | ||
# self.spi.max_speed_hz = 500000 | ||
# to_send = [0x04, 0x00, 0xff] # All gains set x2 | ||
# self.spi.xfer(to_send) | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
R0 (INIT) 0x000090 | ||
R0 0x000000 | ||
R2 0x000200 | ||
R3 0x000306 | ||
R4 0x0004D0 | ||
R5 0x00055B | ||
R6 0x000600 | ||
R12 0x000C51 | ||
R13 0x000D04 | ||
R256 0x010014 | ||
R257 0x010155 | ||
R258 0x010255 | ||
R259 0x010301 | ||
R260 0x010420 | ||
R261 0x010500 | ||
R262 0x01067A | ||
R263 0x010766 | ||
R264 0x010801 | ||
R265 0x010955 | ||
R266 0x010A55 | ||
R267 0x010B01 | ||
R268 0x010C20 | ||
R269 0x010D00 | ||
R270 0x010E70 | ||
R271 0x010F66 | ||
R272 0x01100B | ||
R273 0x011155 | ||
R274 0x011255 | ||
R275 0x011302 | ||
R276 0x011420 | ||
R277 0x011500 | ||
R278 0x0116F8 | ||
R279 0x011711 | ||
R280 0x01180B | ||
R281 0x011955 | ||
R282 0x011A55 | ||
R283 0x011B02 | ||
R284 0x011C20 | ||
R285 0x011D00 | ||
R286 0x011EF0 | ||
R287 0x011F66 | ||
R288 0x01200B | ||
R289 0x012155 | ||
R290 0x012255 | ||
R291 0x012302 | ||
R292 0x012420 | ||
R293 0x012500 | ||
R294 0x0126F0 | ||
R295 0x012766 | ||
R296 0x01280B | ||
R297 0x012955 | ||
R298 0x012A55 | ||
R299 0x012B02 | ||
R300 0x012C20 | ||
R301 0x012D00 | ||
R302 0x012EF0 | ||
R303 0x012F66 | ||
R304 0x013001 | ||
R305 0x013155 | ||
R306 0x013255 | ||
R307 0x013301 | ||
R308 0x013420 | ||
R309 0x013500 | ||
R310 0x013670 | ||
R311 0x013766 | ||
R312 0x013850 | ||
R313 0x013900 | ||
R314 0x013A00 | ||
R315 0x013B20 | ||
R316 0x013C00 | ||
R317 0x013D08 | ||
R318 0x013E03 | ||
R319 0x013F04 | ||
R320 0x0140F8 | ||
R321 0x014100 | ||
R322 0x014208 | ||
R323 0x014350 | ||
R324 0x014400 | ||
R325 0x014500 | ||
R326 0x01461B | ||
R327 0x014700 | ||
R328 0x014802 | ||
R329 0x014902 | ||
R330 0x014A06 | ||
R331 0x014B02 | ||
R332 0x014C00 | ||
R333 0x014D00 | ||
R334 0x014E00 | ||
R335 0x014F7F | ||
R336 0x015001 | ||
R337 0x015102 | ||
R338 0x015200 | ||
R339 0x015300 | ||
R340 0x015478 | ||
R341 0x015500 | ||
R342 0x015678 | ||
R343 0x015700 | ||
R344 0x015878 | ||
R345 0x015909 | ||
R346 0x015AC4 | ||
R347 0x015BF4 | ||
R348 0x015C20 | ||
R349 0x015D00 | ||
R350 0x015E00 | ||
R351 0x015F0B | ||
R352 0x016000 | ||
R353 0x016101 | ||
R354 0x016244 | ||
R355 0x016300 | ||
R356 0x016400 | ||
R357 0x01652C | ||
R369 0x0171AA | ||
R370 0x017202 | ||
R380 0x017C15 | ||
R381 0x017D33 | ||
R358 0x016600 | ||
R359 0x016700 | ||
R360 0x01680C | ||
R361 0x016958 | ||
R362 0x016A20 | ||
R363 0x016B00 | ||
R364 0x016C00 | ||
R365 0x016D00 | ||
R366 0x016E13 | ||
R371 0x017320 | ||
R386 0x018200 | ||
R387 0x018300 | ||
R388 0x018400 | ||
R389 0x018500 | ||
R392 0x018800 | ||
R393 0x018900 | ||
R394 0x018A00 | ||
R395 0x018B00 | ||
R8189 0x1FFD00 | ||
R8190 0x1FFE00 | ||
R8191 0x1FFF53 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
R0 (INIT) 0x000090 | ||
R0 0x000010 | ||
R2 0x000200 | ||
R3 0x000306 | ||
R4 0x0004D0 | ||
R5 0x00055B | ||
R6 0x000600 | ||
R12 0x000C51 | ||
R13 0x000D04 | ||
R256 0x01006A | ||
R257 0x010155 | ||
R258 0x010255 | ||
R259 0x010301 | ||
R260 0x010422 | ||
R261 0x010500 | ||
R262 0x010673 | ||
R263 0x010703 | ||
R264 0x01086A | ||
R265 0x010955 | ||
R266 0x010A55 | ||
R267 0x010B00 | ||
R268 0x010C22 | ||
R269 0x010D00 | ||
R270 0x010EF0 | ||
R271 0x010F30 | ||
R272 0x01106A | ||
R273 0x011155 | ||
R274 0x011255 | ||
R275 0x011301 | ||
R276 0x011422 | ||
R277 0x011500 | ||
R278 0x011673 | ||
R279 0x011703 | ||
R280 0x01186A | ||
R281 0x011955 | ||
R282 0x011A55 | ||
R283 0x011B01 | ||
R284 0x011C22 | ||
R285 0x011D00 | ||
R286 0x011E72 | ||
R287 0x011F03 | ||
R288 0x012074 | ||
R289 0x012155 | ||
R290 0x012255 | ||
R291 0x012301 | ||
R292 0x012422 | ||
R293 0x012500 | ||
R294 0x012670 | ||
R295 0x012733 | ||
R296 0x01286A | ||
R297 0x012955 | ||
R298 0x012A55 | ||
R299 0x012B00 | ||
R300 0x012C22 | ||
R301 0x012D00 | ||
R302 0x012EF0 | ||
R303 0x012F30 | ||
R304 0x01306A | ||
R305 0x013155 | ||
R306 0x013255 | ||
R307 0x013301 | ||
R308 0x013422 | ||
R309 0x013500 | ||
R310 0x013673 | ||
R311 0x013703 | ||
R312 0x013800 | ||
R313 0x013903 | ||
R314 0x013A01 | ||
R315 0x013B40 | ||
R316 0x013C00 | ||
R317 0x013D01 | ||
R318 0x013E03 | ||
R319 0x013F02 | ||
R320 0x014009 | ||
R321 0x014100 | ||
R322 0x014200 | ||
R323 0x014331 | ||
R324 0x0144FF | ||
R325 0x01457F | ||
R326 0x014618 | ||
R327 0x01471A | ||
R328 0x014806 | ||
R329 0x014946 | ||
R330 0x014A06 | ||
R331 0x014B06 | ||
R332 0x014C00 | ||
R333 0x014D00 | ||
R334 0x014EC0 | ||
R335 0x014F7F | ||
R336 0x015013 | ||
R337 0x015102 | ||
R338 0x015200 | ||
R339 0x015300 | ||
R340 0x01547D | ||
R341 0x015500 | ||
R342 0x01567D | ||
R343 0x015703 | ||
R344 0x0158C0 | ||
R345 0x015907 | ||
R346 0x015AD0 | ||
R347 0x015BDA | ||
R348 0x015C20 | ||
R349 0x015D00 | ||
R350 0x015E00 | ||
R351 0x015F3E | ||
R352 0x016000 | ||
R353 0x016119 | ||
R354 0x016244 | ||
R355 0x016300 | ||
R356 0x016400 | ||
R357 0x0165A0 | ||
R369 0x0171AA | ||
R370 0x017202 | ||
R380 0x017C15 | ||
R381 0x017D33 | ||
R358 0x016600 | ||
R359 0x016700 | ||
R360 0x0168C0 | ||
R361 0x016959 | ||
R362 0x016A20 | ||
R363 0x016B00 | ||
R364 0x016C00 | ||
R365 0x016D00 | ||
R366 0x016E1B | ||
R371 0x017300 | ||
R8189 0x1FFD00 | ||
R8190 0x1FFE00 | ||
R8191 0x1FFF53 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import spidev | ||
|
||
|
||
DACS = [0, 1, 2, 3, 4, 5, 6, 7] | ||
MAX_VOLTAGE = 1.5 # V | ||
|
||
class DAC80508: | ||
def __init__(self): | ||
self.spi = spidev.SpiDev() | ||
self.spi.open(1, 0) | ||
self.spi.mode = 0 | ||
self.spi.max_speed_hz = 500000 | ||
|
||
to_send = [0x04, 0x00, 0xff] # All gains set x2 | ||
self.spi.xfer(to_send) | ||
|
||
# Set all dacs to 0V | ||
for dac in DACS: | ||
to_send = [0x08+dac, 0x80, 0x00] | ||
self.spi.xfer(to_send) | ||
|
||
def set_bias(self, dac:int, bias: float): | ||
if not dac in DACS: | ||
raise ValueError(f"dac should be any of {DACS}") | ||
if abs(bias) > MAX_VOLTAGE: | ||
raise ValueError(f"Bias values should be between -{MAX_VOLTAGE} and {MAX_VOLTAGE} V") | ||
|
||
register_value = int(bias * (0xffff - 0x8000) / 2.5000) + 0x8000 | ||
high_byte = (register_value & 0xff00) >> 8 | ||
low_byte = (register_value & 0x00ff) | ||
to_send = [0x08+dac, high_byte, low_byte] | ||
self.spi.xfer(to_send) |
Binary file not shown.
Oops, something went wrong.