pca9555.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (C) 2009 by Rittal GmbH & Co. KG,
  3. * Ulrich Prinz <prinz.u@rittal.de> All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. Neither the name of the copyright holders nor the names of
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY EMBEDDED IT AND CONTRIBUTORS
  19. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  21. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EMBEDDED IT
  22. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  23. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  25. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  26. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  27. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  28. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. * For additional information see http://www.ethernut.de/
  31. *
  32. */
  33. /*
  34. * $Log$
  35. *
  36. * Revision 1.0 2009/04/13 ulrichprinz
  37. * First checkin, new twi driver for pca9555 (currently SAM7X256 is tested
  38. * only)
  39. *
  40. */
  41. #ifndef _DEV_PCA9555_H_
  42. #define _DEV_PCA9555_H_
  43. #include <cfg/pca9555.h>
  44. #include <dev/twif.h>
  45. #define IOXP_PORT0 0x80
  46. #define IOXP_PORT1 0x81
  47. #define IOXP_PIN0 0
  48. #define IOXP_PIN1 1
  49. #define IOXP_PIN2 2
  50. #define IOXP_PIN3 3
  51. #define IOXP_PIN4 4
  52. #define IOXP_PIN5 5
  53. #define IOXP_PIN6 6
  54. #define IOXP_PIN7 7
  55. #define GPIO_CFG_INVERT 0x00010000
  56. #define GPIO_CFG_NORM 0x00020000
  57. extern int IOExpInit( void );
  58. extern int IOExpPinConfigSet( int bank, int bit, uint32_t flags);
  59. extern int IOExpRawWrite ( int bank, int value );
  60. extern int IOExpRawRead ( int bank, int *value );
  61. extern int IOExpSetBitLow( int bank, int bit );
  62. extern int IOExpSetBitHigh( int bank, int bit );
  63. extern int IOExpGetBit ( int bank, int bit, int *value );
  64. extern int IOExpSetBit( int bank, int bit, int value );
  65. #endif