gnd_layouts.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. """
  2. # TOP2049 Open Source programming suite
  3. #
  4. # TOP2049 GND layout definitions
  5. #
  6. # Copyright (c) 2010 Michael Buesch <m@bues.ch>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License along
  19. # with this program; if not, write to the Free Software Foundation, Inc.,
  20. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. """
  22. import sys
  23. if __name__ == "__main__":
  24. sys.path.insert(0, sys.path[0] + "/../..")
  25. from libtoprammer.generic_layout import *
  26. class GNDLayout(GenericLayout):
  27. # A list of valid ZIF GND pins (0=none)
  28. validPins = (0, 5, 14, 15, 16, 17, 18, 19, 20, 24, 26, 27,
  29. 28, 29, 33, 34, 35)
  30. def __init__(self, top=None):
  31. GenericLayout.__init__(self, nrZifPins=48)
  32. self.top = top
  33. self.layouts = []
  34. for pin in self.validPins:
  35. id = pin
  36. if id != 0:
  37. id -= 4
  38. mask = 0
  39. if pin != 0:
  40. mask |= (1 << (pin - 1))
  41. self.layouts.append( (id, mask) )
  42. def supportedLayouts(self):
  43. return self.layouts
  44. def setLayoutID(self, id):
  45. self.top.cmdLoadGNDLayout(id)
  46. if __name__ == "__main__":
  47. print("ZIF socket GND layouts")
  48. print(GNDLayout())