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.
Revision 1:9ab20d13c44e, committed 2014-10-21
- Comitter:
- jjones646
- Date:
- Tue Oct 21 06:33:14 2014 +0000
- Parent:
- 0:893f387bda9f
- Child:
- 2:330355f546b0
- Commit message:
- adding helloworld program
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HelloWorld.cpp Tue Oct 21 06:33:14 2014 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+#include "SX1509.h"
+
+#define WAIT_TIME 0.1
+
+DigitalOut led1(LED1);
+SX1509 expander(p9, p10);
+
+int main()
+{
+ // Configure the SX1509 for LED ouputs on the "A" side
+ expander.enableLED(B);
+
+ // Setup a fading LED loop
+ expander.setupLED(IO7);
+
+ // Main loop
+ while (1) {
+ led1 = !led1;
+ }
+}
\ No newline at end of file
--- a/SX1509.cpp Tue Oct 21 04:07:43 2014 +0000
+++ b/SX1509.cpp Tue Oct 21 06:33:14 2014 +0000
@@ -369,14 +369,6 @@
void SX1509::setupLED(LED_t led)
{
int i = 0;
- /*
- write_register(led + i++, 0x03); // T_on
- write_register(led + i++, 0xFF); // Intensity
- write_register(led + i++, (0x01<<3)|(0x00)); // T_off
- write_register(led + i++, 0x01); // T_rise
- write_register(led + i, 0x01); // T_fall
- */
-
write_register(led + i++, 0x00); // T_on
write_register(led + i++, 0x0A); // Intensity
write_register(led + i++, (0x01<<3)|(0x00)); // T_off
--- a/SX1509.h Tue Oct 21 04:07:43 2014 +0000
+++ b/SX1509.h Tue Oct 21 06:33:14 2014 +0000
@@ -12,9 +12,6 @@
#define SX1509_ADDRESS_2 0x3F
#define SX1509_ADDRESS_3 0x70
#define SX1509_ADDRESS_4 0x71
-//#define PARAM_WRITE 0x00
-#define DIR_ALL_OUTPUTS 0x00
-
// DEFINES - Register Addresses
// ====================================================
@@ -139,6 +136,9 @@
// ====================================================
#define BUFFER_SIZE (8)
+
+// ENUMERATIONS
+// ====================================================
enum Direction_t {
OUT = 0,
IN
@@ -185,20 +185,16 @@
// ====================================================
class SX1509
{
-
private:
Direction_t dirA, dirB;
char buf[BUFFER_SIZE];
-
protected:
DigitalIn *_intN;
DigitalOut *_resetN;
I2C *_i2c;
-
bool hasInt, hasReset;
-
void init(PinName, PinName, PinName, PinName);
void direction(Direction_t, Side_t);
int transfer_data(char const, char const, Transfer_t);
@@ -232,5 +228,7 @@
void clearAll(Side_t);
void enableLED(Side_t);
void setupLED(LED_t);
+
};
+
#endif
\ No newline at end of file
SX1590