From 366a18a6cbe9d954bc7514c7b531a053e0843e5d Mon Sep 17 00:00:00 2001 From: Bertold Van den Bergh Date: Tue, 29 Nov 2022 12:59:12 +0100 Subject: [PATCH] Use GPIO interface to enable SPI GPIOs --- mshal/hal_flash.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mshal/hal_flash.go b/mshal/hal_flash.go index 9cc4da0..9302a82 100644 --- a/mshal/hal_flash.go +++ b/mshal/hal_flash.go @@ -12,9 +12,12 @@ func (h *HAL) ms2130enableSPI(enable bool) error { } /* Configure GPIO */ - if _, err := h.MemoryRegionGet(MemoryRegionSFR).Access(true, 0xb0-0x80, []byte{0xe1}); err != nil { + output := byte(1<<2 | 1<<3 | 1<<4) + input := byte(1 << 5) + if _, _, err := h.GPIOUpdate(output, 0, output, input); err != nil { return err } + value = byte(0x10) } else { if h.ms2130spiEnabled == 0 {