summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/fmradio-i2c-as3525.c5
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c4
2 files changed, 3 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/fmradio-i2c-as3525.c b/firmware/target/arm/as3525/fmradio-i2c-as3525.c
index 31d701d..33d12f9 100644
--- a/firmware/target/arm/as3525/fmradio-i2c-as3525.c
+++ b/firmware/target/arm/as3525/fmradio-i2c-as3525.c
@@ -30,7 +30,6 @@
#include "as3525.h"
#include "generic_i2c.h"
#include "fmradio_i2c.h"
-#include "system.h"
#if defined(SANSA_CLIP) || defined(SANSA_C200V2)
#define I2C_SCL_GPIO(x) GPIOB_PIN(x)
@@ -168,13 +167,11 @@ void fmradio_i2c_init(void)
int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
{
#ifdef SANSA_FUZEV2
- int s = disable_irq_save();
CCU_IO &= ~(1<<12);
#endif
int ret = i2c_write_data(fm_i2c_bus, address, -1, buf, count);
#ifdef SANSA_FUZEV2
CCU_IO |= 1<<12;
- restore_irq(s);
#endif
return ret;
}
@@ -182,13 +179,11 @@ int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count
int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
{
#ifdef SANSA_FUZEV2
- int s = disable_irq_save();
CCU_IO &= ~(1<<12);
#endif
int ret = i2c_read_data(fm_i2c_bus, address, -1, buf, count);
#ifdef SANSA_FUZEV2
CCU_IO |= 1<<12;
- restore_irq(s);
#endif
return ret;
}
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index fcda522..4486af9 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -230,6 +230,7 @@ int button_read_device(void)
int delay = 30;
while(delay--) nop;
+ bool ccu_io_bit12 = CCU_IO & (1<<12);
CCU_IO &= ~(1<<12);
/* B1 is shared with FM i2c */
@@ -273,7 +274,8 @@ int button_read_device(void)
if(gpiob_pin0_dir)
GPIOB_DIR |= 1<<1;
- CCU_IO |= 1<<12;
+ if(ccu_io_bit12)
+ CCU_IO |= 1<<12;
#ifdef HAS_BUTTON_HOLD
#ifndef BOOTLOADER