summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/dev/egpio.c
blob: c17fe81b2d5e61b26da40e9273e9c6182d709f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdlib.h>
#include <stdint.h>

#include "eos.h"
#include "soc/i2c.h"

#include "fxl6408.h"
#include "egpio.h"

int eos_egpio_pin_get(uint8_t reg, uint8_t pin, uint8_t *val) {
    uint8_t chip_id;
    int rv;

    chip_id = (pin & EGPIO_PIN_MASK_CHIP_ID) >> 4;
    pin &= EGPIO_PIN_MASK;

    rv = eos_fxl6408_pin_get(chip_id, reg, pin, val);
    return rv;
}

int eos_egpio_pin_set(uint8_t reg, uint8_t pin, uint8_t val) {
    uint8_t chip_id;
    int rv;

    chip_id = (pin & EGPIO_PIN_MASK_CHIP_ID) >> 4;
    pin &= EGPIO_PIN_MASK;

    rv = eos_fxl6408_pin_set(chip_id, reg, pin, val);
    return rv;
}