summaryrefslogtreecommitdiff
path: root/firmware/export/pca9555.h
blob: 3180114e14ff35dde4e72230a53ee6a6c304349c (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2013 Andrew Ryabinin
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#ifndef _PCA9555_H
#define _PCA9555_H

#include "pca9555-target.h"

#define PCA9555_IN0_CMD      0
#define PCA9555_IN1_CMD      1
#define PCA9555_OUT0_CMD     2
#define PCA9555_OUT1_CMD     3
#define PCA9555_POL0_INV_CMD 4
#define PCA9555_POL1_INV_CMD 5
#define PCA9555_CFG0_CMD     6
#define PCA9555_CFG1_CMD     7

#define PCA9555_IN_CMD       PCA9555_IN0_CMD
#define PCA9555_OUT_CMD      PCA9555_OUT0_CMD
#define PCA9555_POL_INV_CMD  PCA9555_POL0_INV_CMD
#define PCA9555_CFG_CMD      PCA9555_CFG0_CMD

void pca9555_target_init(void);
void pca9555_init(void);
unsigned short pca9555_read_input(void);
unsigned short pca9555_read_output(void);
unsigned short pca9555_read_config(void);
void pca9555_write_output(const unsigned short data, const unsigned short mask);
void pca9555_write_config(const unsigned short data, const unsigned short mask);

#endif