modstm.py 349 B

12345678910111213
  1. # test stm module
  2. import stm
  3. import pyb
  4. # test storing a full 32-bit number
  5. # turn on then off the A15(=yellow) LED
  6. BSRR = 0x18
  7. stm.mem32[stm.GPIOA + BSRR] = 0x00008000
  8. pyb.delay(100)
  9. print(hex(stm.mem32[stm.GPIOA + stm.GPIO_ODR] & 0x00008000))
  10. stm.mem32[stm.GPIOA + BSRR] = 0x80000000
  11. print(hex(stm.mem32[stm.GPIOA + stm.GPIO_ODR] & 0x00008000))