Пример #1
0
##data_nodc *= np.blackman(NUM_SAMPLES)
##fftdata = np.abs(np.fft.fft(data_nodc)) / NUM_SAMPLES
##fftdb = 20*np.log10(fftdata / 2.0**31)
#plt.figure(1)
#plt.plot(data_ch0)
#
#




# The next section shows how to properly shut down the SoCkit board. It's a
# Linux computer after all, with nonvolatile storage that should be unmounted
# cleanly. Just cutting the power will force a filesystem check (fsck) on the
# next boot. You can either set "choice = 'y'" below, or type
# "client.shutdown()" in the Python console

# What client.shutdown() really does is execute the command:
# "shutdown -h now"
# on the SoCkit board.


choice = 'n'
#choice = raw_input('Shutdown: y/n? ')
if(choice == 'y'):
    print 'Shutting down ...'
#    time.sleep(30)
    client.shutdown()


eeprom_id = client.read_eeprom_id(i2c_output_base_reg, i2c_input_base_reg)
if (verbose): print 'EEPROM ID string: %s' % eeprom_id
print 'IC identified: %s' % (eeprom_id.split(','))[0]

print '**Tested DC590 commands**\n'

############client.send_json("cd fpga_bitfiles")

#### I2C stuff - to be tested again. #####

#print 'Detecting I2C devices. Number of device: ',
#print client.i2c_identify()

#print 'I2C Testing... ',
#print client.i2c_testing()
#
#slave_address = 0x73  # Globoal 7-bit address: 111 0011
#part_command = 0x2F      # 0010 (write and update all) 1111 (all DACs)
#num_of_bytes = 2
#vals = [0x00, 0x00]
#print 'I2C write byte... ',
#print client.i2c_write_byte(slave_address, part_command, num_of_bytes, vals, dummy = True)
#
#print 'I2C read EEPROM... ',
#print client.i2c_read()
#
choice = raw_input('\nShutdown: y/n? ')
if (choice == 'y'):
    shut = client.shutdown(dummy=False)
    print('Shutting down...' if shut == True else 'Shutdown Failed!')