diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-03-21 02:24:59 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-03-21 02:24:59 +0100 |
commit | 0a5f8363fe4e6b3c7d4f17fde61e00ab63e43bcb (patch) | |
tree | 6c99f62b31cb52820ba7fb97edc5f95d5db4d0bf /fw/fe310/eos/eve | |
parent | 2e2dda8fa91b946c7d1a3a2de00327ee74f398fc (diff) |
i2s stereo driver
Diffstat (limited to 'fw/fe310/eos/eve')
-rw-r--r-- | fw/fe310/eos/eve/eve.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c index 91458d8..e1191fc 100644 --- a/fw/fe310/eos/eve/eve.c +++ b/fw/fe310/eos/eve/eve.c @@ -458,27 +458,27 @@ void eve_brightness(uint8_t b) { int eve_gpio_get(int gpio) { uint16_t reg = eve_read16(REG_GPIOX); + return !!(reg & (1 << gpio)); } void eve_gpio_set(int gpio, int val) { uint16_t reg = eve_read16(REG_GPIOX); uint16_t reg_val = (1 << gpio); - if (val) { - reg |= reg_val; - } else { - reg &= ~reg_val; - } + + reg = val ? reg | reg_val : reg & ~reg_val; eve_write16(REG_GPIOX, reg); } uint8_t eve_gpio_get_dir(void) { uint16_t reg = eve_read16(REG_GPIOX_DIR); + return reg & 0x000f; } void eve_gpio_set_dir(uint8_t dir) { uint16_t reg = eve_read16(REG_GPIOX_DIR); + reg &= 0xfff0; reg |= dir & 0x0f; eve_write16(REG_GPIOX_DIR, reg); |