Mini board PCU9669 evaluation kit library

Committer:
nxp_ip
Date:
Wed Jul 11 11:18:44 2012 +0000
Revision:
3:61ba368b0de4
Parent:
2:9a1d020f6233
for mini_board_PCU9669 v1.1 release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nxp_ip 0:45e6b54f22e3 1 /** A sample code for "mini board PCU9669/PCA9665"
nxp_ip 0:45e6b54f22e3 2 *
nxp_ip 1:dd16429c98bb 3 * @author Akifumi (Tedd) OKANO, NXP Semiconductors
nxp_ip 3:61ba368b0de4 4 * @version 1.1
nxp_ip 3:61ba368b0de4 5 * @date 11-Jul-2012
nxp_ip 0:45e6b54f22e3 6 *
nxp_ip 0:45e6b54f22e3 7 * Released under the MIT License: http://mbed.org/license/mit
nxp_ip 0:45e6b54f22e3 8 *
nxp_ip 0:45e6b54f22e3 9 * An operation sample of PCU9669/PCA9665 I2C bus controller.
nxp_ip 0:45e6b54f22e3 10 * The mbed accesses the bus controller's parallel port (8/2 bit address and 8 bit data) by bit-banging.
nxp_ip 0:45e6b54f22e3 11 * The bit-banging is poerformed by PortInOut function of mbed library.
nxp_ip 0:45e6b54f22e3 12 *
nxp_ip 0:45e6b54f22e3 13 * To make the code porting easier, all codes are partitioned into layers to abstract other parts.
nxp_ip 0:45e6b54f22e3 14 * The mbed specific parts are concentrated in lowest layer: "hardware_abs.*".
nxp_ip 0:45e6b54f22e3 15 * This module may need to be modified for the porting.
nxp_ip 0:45e6b54f22e3 16 *
nxp_ip 0:45e6b54f22e3 17 * All other upper layers are writen in standard-C.
nxp_ip 0:45e6b54f22e3 18 *
nxp_ip 0:45e6b54f22e3 19 * base code is written from 05-Sep-2011 to 09-Sep-2011.
nxp_ip 0:45e6b54f22e3 20 * And demo code has been build on 11-Sep-2011.
nxp_ip 0:45e6b54f22e3 21 * Debug and code adjustment has been done on 08-Sep-2011.
nxp_ip 0:45e6b54f22e3 22 * Small sanitization for main.cpp. All mbed related codes are moved in to "hardware_abs.*". 13-Oct-2011
nxp_ip 0:45e6b54f22e3 23 * hardware_abs are moved into parallel_bus library folder, 3 LED driver operation sample 13-Feb.-2012
nxp_ip 0:45e6b54f22e3 24 * PCU9669 and PCA9665 codes are packed in a project 14-Feb-2012.
nxp_ip 0:45e6b54f22e3 25 *
nxp_ip 0:45e6b54f22e3 26 * Before builidng the code, please edit the file mini_board_PCU9669/config.h
nxp_ip 1:dd16429c98bb 27 * Un-comment the target name what you want to target.
nxp_ip 0:45e6b54f22e3 28 */
nxp_ip 0:45e6b54f22e3 29
nxp_ip 0:45e6b54f22e3 30
nxp_ip 0:45e6b54f22e3 31 /** PCx9955 (PCU9955 and PCA9955) related definitions
nxp_ip 0:45e6b54f22e3 32 *
nxp_ip 0:45e6b54f22e3 33 * PCx9955's internal register name and address definitions, I2C address difinitions
nxp_ip 0:45e6b54f22e3 34 */
nxp_ip 0:45e6b54f22e3 35
nxp_ip 0:45e6b54f22e3 36 #ifndef MINIBOARD_PCx9955_REG__
nxp_ip 0:45e6b54f22e3 37 #define MINIBOARD_PCx9955_REG__
nxp_ip 0:45e6b54f22e3 38
nxp_ip 0:45e6b54f22e3 39 /** @var Register names
nxp_ip 0:45e6b54f22e3 40 *
nxp_ip 0:45e6b54f22e3 41 * PCx9955 internal register name and addesses
nxp_ip 0:45e6b54f22e3 42 */
nxp_ip 0:45e6b54f22e3 43 typedef enum {
nxp_ip 0:45e6b54f22e3 44 MODE1 = 0x00,
nxp_ip 0:45e6b54f22e3 45 MODE2,
nxp_ip 0:45e6b54f22e3 46 LEDOUT0,
nxp_ip 0:45e6b54f22e3 47 LEDOUT1,
nxp_ip 0:45e6b54f22e3 48 LEDOUT2,
nxp_ip 0:45e6b54f22e3 49 LEDOUT3,
nxp_ip 0:45e6b54f22e3 50 GRPPWM = 0x08,
nxp_ip 0:45e6b54f22e3 51 GRPFREQ,
nxp_ip 0:45e6b54f22e3 52 PWM0 = 0x0A,
nxp_ip 0:45e6b54f22e3 53 PWM1,
nxp_ip 0:45e6b54f22e3 54 PWM2,
nxp_ip 0:45e6b54f22e3 55 PWM3,
nxp_ip 0:45e6b54f22e3 56 PWM4,
nxp_ip 0:45e6b54f22e3 57 PWM5,
nxp_ip 0:45e6b54f22e3 58 PWM6,
nxp_ip 0:45e6b54f22e3 59 PWM7,
nxp_ip 0:45e6b54f22e3 60 PWM8,
nxp_ip 0:45e6b54f22e3 61 PWM9,
nxp_ip 0:45e6b54f22e3 62 PWM10,
nxp_ip 0:45e6b54f22e3 63 PWM11,
nxp_ip 0:45e6b54f22e3 64 PWM12,
nxp_ip 0:45e6b54f22e3 65 PWM13,
nxp_ip 0:45e6b54f22e3 66 PWM14,
nxp_ip 0:45e6b54f22e3 67 PWM15,
nxp_ip 0:45e6b54f22e3 68 IREF0 = 0x22,
nxp_ip 0:45e6b54f22e3 69 IREF1,
nxp_ip 0:45e6b54f22e3 70 IREF2,
nxp_ip 0:45e6b54f22e3 71 IREF3,
nxp_ip 0:45e6b54f22e3 72 IREF4,
nxp_ip 0:45e6b54f22e3 73 IREF5,
nxp_ip 0:45e6b54f22e3 74 IREF6,
nxp_ip 0:45e6b54f22e3 75 IREF7,
nxp_ip 0:45e6b54f22e3 76 IREF8,
nxp_ip 0:45e6b54f22e3 77 IREF9,
nxp_ip 0:45e6b54f22e3 78 IREF10,
nxp_ip 0:45e6b54f22e3 79 IREF11,
nxp_ip 0:45e6b54f22e3 80 IREF12,
nxp_ip 0:45e6b54f22e3 81 IREF13,
nxp_ip 0:45e6b54f22e3 82 IREF14,
nxp_ip 0:45e6b54f22e3 83 IREF15,
nxp_ip 0:45e6b54f22e3 84 OFFSET = 0x3A,
nxp_ip 0:45e6b54f22e3 85 SUBADR1,
nxp_ip 0:45e6b54f22e3 86 SUBADR2,
nxp_ip 0:45e6b54f22e3 87 SUBADR3,
nxp_ip 0:45e6b54f22e3 88 ALLCALLADR,
nxp_ip 0:45e6b54f22e3 89 RESERVED1,
nxp_ip 0:45e6b54f22e3 90 RESERVED2,
nxp_ip 0:45e6b54f22e3 91 RESERVED3,
nxp_ip 0:45e6b54f22e3 92 PWMALL,
nxp_ip 0:45e6b54f22e3 93 IREFALL,
nxp_ip 0:45e6b54f22e3 94 EFLAG0,
nxp_ip 0:45e6b54f22e3 95 EFLAG1,
nxp_ip 0:45e6b54f22e3 96
nxp_ip 0:45e6b54f22e3 97 REGISTER_START = MODE1,
nxp_ip 0:45e6b54f22e3 98 LEDOUT_REGISTER_START = LEDOUT0,
nxp_ip 0:45e6b54f22e3 99 PWM_REGISTER_START = PWM0,
nxp_ip 0:45e6b54f22e3 100 IREF_REGISTER_START = IREF0,
nxp_ip 0:45e6b54f22e3 101 }
nxp_ip 0:45e6b54f22e3 102 PCx9955_reg;
nxp_ip 0:45e6b54f22e3 103
nxp_ip 0:45e6b54f22e3 104 /** @var PCx9955 I2C bus addresses
nxp_ip 0:45e6b54f22e3 105 */
nxp_ip 0:45e6b54f22e3 106 typedef enum {
nxp_ip 0:45e6b54f22e3 107 PCx9955_ADDR0 = 0xC0,
nxp_ip 0:45e6b54f22e3 108 PCx9955_ADDR1 = 0xC2,
nxp_ip 0:45e6b54f22e3 109 PCx9955_ADDR2 = 0xC4,
nxp_ip 0:45e6b54f22e3 110 PCx9955_ADDR3 = 0xC6,
nxp_ip 0:45e6b54f22e3 111 PCx9955_ADDR4 = 0xC8,
nxp_ip 0:45e6b54f22e3 112 PCx9955_ADDR5 = 0xCA,
nxp_ip 0:45e6b54f22e3 113 PCx9955_ADDR6 = 0xCC,
nxp_ip 0:45e6b54f22e3 114 PCx9955_ADDR7 = 0xCE,
nxp_ip 0:45e6b54f22e3 115 PCx9955_ADDR8 = 0xD0,
nxp_ip 0:45e6b54f22e3 116 PCx9955_ADDR9 = 0xD2,
nxp_ip 0:45e6b54f22e3 117 PCx9955_ADDRA = 0xD4,
nxp_ip 0:45e6b54f22e3 118 PCx9955_ADDRB = 0xD6,
nxp_ip 2:9a1d020f6233 119 PCx9955_ADDRC = 0xD8,
nxp_ip 2:9a1d020f6233 120 PCx9955_ADDRD = 0xDA,
nxp_ip 2:9a1d020f6233 121 PCx9955_ADDRE = 0xDC,
nxp_ip 2:9a1d020f6233 122 PCx9955_ADDRF = 0xDE
nxp_ip 0:45e6b54f22e3 123 }
nxp_ip 0:45e6b54f22e3 124 pcx9955_addr;
nxp_ip 0:45e6b54f22e3 125
nxp_ip 0:45e6b54f22e3 126
nxp_ip 0:45e6b54f22e3 127 /** @def PWM_INIT / IREF_INIT
nxp_ip 0:45e6b54f22e3 128 *
nxp_ip 0:45e6b54f22e3 129 * Initial value for the PWMn and IREFn registers
nxp_ip 0:45e6b54f22e3 130 */
nxp_ip 0:45e6b54f22e3 131 #define PWM_INIT 0x00
nxp_ip 0:45e6b54f22e3 132 #define IREF_INIT 0xFF
nxp_ip 0:45e6b54f22e3 133
nxp_ip 0:45e6b54f22e3 134 #endif // MINIBOARD_PCx9955_REG__