Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PCA9532.h
00001 /* PCA9532 00002 * (c) 2009, cstyles 00003 */ 00004 00005 #ifndef PCA9532_H 00006 #define PCA9532_H 00007 00008 #include "mbed.h" 00009 00010 // register names 00011 #define PCA9532_REG_INPUT0 0 00012 #define PCA9532_REG_INPUT1 1 00013 #define PCA9532_REG_PSC0 2 00014 #define PCA9532_REG_PWM0 3 00015 #define PCA9532_REG_PSC1 4 00016 #define PCA9532_REG_PWM1 5 00017 #define PCA9532_REG_LS0 6 00018 #define PCA9532_REG_LS1 7 00019 #define PCA9532_REG_LS2 8 00020 #define PCA9532_REG_LS3 9 00021 00022 #define PCA9532_MODE_CLEAR 0 00023 #define PCA9532_MODE_SET 1 00024 #define PCA9532_MODE_PWM0 2 00025 #define PCA9532_MODE_PWM1 3 00026 00027 00028 00029 00030 00031 class PCA9532 { 00032 00033 public: 00034 00035 PCA9532(PinName sda, PinName scl, int addr); 00036 00037 void write (int leds); 00038 00039 void set (int leds); 00040 void clear (int leds); 00041 void pwm0 (int leds); 00042 void pwm1 (int leds); 00043 00044 void duty0 (float d); 00045 void duty1 (float d); 00046 00047 void period0 (float t); 00048 void period1 (float t); 00049 00050 protected: 00051 00052 void _write(int reg, int data); 00053 int _read(int reg); 00054 00055 void _rmw(int led, int mode); 00056 00057 int _addr; 00058 00059 I2C _i2c; 00060 00061 }; 00062 00063 00064 #endif
Generated on Fri Jul 15 2022 02:53:23 by
1.7.2