Skip to content

Commit b9a8750

Browse files
author
Jim Lindblom
committed
Update Arduino/libraries/SX1509/readme.md
1 parent 15bc83b commit b9a8750

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

Arduino/libraries/SX1509/readme.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ These functions work much like the Arduino *digitalWrite* and *pinMode* function
5959

6060
For an example sketch using these functions, check out the [sx1509_digitalReadWrite example](https://github.com/sparkfun/SX1509_IO-Expander/tree/master/Arduino/libraries/SX1509/examples/sx1509_digitalReadWrite).
6161

62-
**pinDir(byte pin, byte inOut)**: Pin direction (INPUT/OUTPUT) control
62+
### pinDir(byte pin, byte inOut)
63+
Pin direction (INPUT/OUTPUT) control
6364

6465
Input:
6566

@@ -70,7 +71,8 @@ Examples:<br>
7071
`` sx1509.pinDir(1, INPUT); // Set SX1509 pin 1 as an input ``<br>
7172
`` sx1509.pinDir(15, OUTPUT); // Set SX1509 pin 15 as an output``
7273

73-
**writePin(byte pin, byte highLow)**: Writes a pin to either high or low if it's configured as an OUTPUT. If the pin is configured as an INPUT, this method will activate either the PULL-UP or PULL-DOWN resistor (HIGH or LOW respectively).
74+
### writePin(byte pin, byte highLow)
75+
Writes a pin to either high or low if it's configured as an OUTPUT. If the pin is configured as an INPUT, this method will activate either the PULL-UP or PULL-DOWN resistor (HIGH or LOW respectively).
7476

7577
Input:
7678

@@ -81,7 +83,8 @@ Examples:<br>
8183
``sx1509.writePin(1, HIGH); // If pin 1 is an INPUT, this activates a pull-up resistor ``<br>
8284
``sx1509.writePin(15, LOW); // If pin 15 is an OUTPUT, this writes the pin LOW``
8385

84-
**readPin(byte pin)**: Reads the digital value (HIGH/LOW) of a pin. The pin should be configured as an INPUT.
86+
### readPin(byte pin)
87+
Reads the digital value (HIGH/LOW) of a pin. The pin should be configured as an INPUT.
8588

8689
Input:
8790

@@ -102,7 +105,8 @@ For an example sketch using these functions, check out the [sx1509_ledDriver exa
102105

103106
Here's the functions available to do some LED driving:
104107

105-
**ledDriverInit(byte pin, byte freq, bool log)**: Initializes LED driving on a pin. This function must be called if you want to use the pwm or blink functions on that pin.
108+
### ledDriverInit(byte pin, byte freq, bool log)
109+
Initializes LED driving on a pin. This function must be called if you want to use the pwm or blink functions on that pin.
106110

107111
Inputs:
108112

@@ -121,7 +125,8 @@ Examples:<br>
121125
``sx1509.ledDriverInit(14); // Enables LED driving on pin 14, defaults to no clock divider and linear intensity.``
122126

123127

124-
**pwm(byte pin, byte iOn)**: This function can be used to control the intensity of an output pin connected to an LED.
128+
### pwm(byte pin, byte iOn)
129+
This function can be used to control the intensity of an output pin connected to an LED.
125130

126131
Inputs:
127132

@@ -133,7 +138,8 @@ Example:<br>
133138
``sx1509.pwm(0, 127); // Sets LED on pin 0 to medium intensity ``<br>
134139
``sx1509.pwm(14, 255); // Sets LED on pin 14 to 100% on``
135140

136-
**blink(byte pin, byte tOn, byte tOff, byte offIntensity, byte tRise, byte tFall)**: Controls both the **blink and breathe** functionality on LED pins.
141+
### blink(byte pin, byte tOn, byte tOff, byte offIntensity, byte tRise, byte tFall)
142+
Controls both the **blink and breathe** functionality on LED pins.
137143

138144
Input:
139145

@@ -168,7 +174,8 @@ For an example sketch using the keypad functions check out the [sx1509_keypad](h
168174

169175
There are two functions used by the keypad engine - one to initialize the keypad, and one to read it.
170176

171-
**keypad(byte rows, byte columns, byte sleepTime, byte scanTime)**: Initializes the keypad function on the SX1509.
177+
### keypad(byte rows, byte columns, byte sleepTime, byte scanTime)
178+
Initializes the keypad function on the SX1509.
172179

173180
Inputs:
174181

@@ -203,7 +210,8 @@ Examples:<br>
203210
``sx1509.keypad(7, 7); // Creates an 8x8 keypad. 64 keys! Fastest scan time.``<br>
204211
``sx1509.keypad(3, 2, 3, 2); // 4 row, 3 column keypad keypad - 12 keys. Sleep about half a second, 4ms scan time.``
205212

206-
**readKeyData()**: Returns a 16-bit value containing the status of the keypad engine.
213+
### readKeyData()
214+
Returns a 16-bit value containing the status of the keypad engine.
207215

208216
Output: A 16-bit value is returned. The lower 8 bits represent the up-to 8 rows, while the MSB represents the up-to 8 columns. Bit-values of 1 indicate a button in that row or column is being pressed. As such, at least two bits should be set.
209217

@@ -221,7 +229,8 @@ Want to make use of the SX1509's interrupt output? Want an interrupt generated w
221229

222230
For an example sketch using the SX1509's interrupt functionality check out the [sx1509_interruptDebounce example](https://github.com/sparkfun/SX1509_IO-Expander/tree/master/Arduino/libraries/SX1509/examples/sx1509_interruptDebounce).
223231

224-
**enableInterrupt(byte pin, byte riseFall)**: This function sets up an interrupt on a pin. Interrupts can occur on all SX1509 pins, and can be generated on rising, falling, or both.
232+
### enableInterrupt(byte pin, byte riseFall)
233+
This function sets up an interrupt on a pin. Interrupts can occur on all SX1509 pins, and can be generated on rising, falling, or both.
225234

226235
Inputs:
227236

@@ -233,7 +242,8 @@ Inputs:
233242

234243
This function does not set up a pin as an input, or configure its pull-up/down resistors!
235244

236-
**interruptSource(void)**: Returns an unsigned int representing which pin caused an interrupt.
245+
### interruptSource(void)
246+
Returns an unsigned int representing which pin caused an interrupt.
237247

238248
Output: 16-bit value, with a single bit set representing the pin(s) that generated an interrupt. E.g. a return value of 0x0104 would mean pins 8 and 3 (bits 8 and 3) have generated an interrupt.
239249

@@ -245,7 +255,8 @@ Getting some jitter in the SX1509 inputs? Need to add debounce to your keypad sc
245255

246256
For an example sketch using the SX1509's debounce functionality check out the [sx1509_interruptDebounce example](https://github.com/sparkfun/SX1509_IO-Expander/tree/master/Arduino/libraries/SX1509/examples/sx1509_interruptDebounce).
247257

248-
**debounceConfig(byte configValue)**: This method configures the debounce time of every input.
258+
### debounceConfig(byte configValue)
259+
This method configures the debounce time of every input.
249260

250261
Input:
251262

@@ -261,7 +272,8 @@ Input:
261272

262273
fOSC is set with the configClock function. It defaults to 2MHz.
263274

264-
**debounceEnable(byte pin)**: This method enables debounce on SX1509 input pin.
275+
### debounceEnable(byte pin)
276+
This method enables debounce on SX1509 input pin.
265277

266278
Input:
267279

@@ -275,13 +287,15 @@ Need to **reset** the SX1509 (hardware or software)? Want to **configure the clo
275287

276288
These functions are all interspersed through many of the library examples sketches.
277289

278-
**reset(bool hardware)**: This function resets the SX1509 - either a hardware reset or software. A hardware reset (hardware parameter = 1) pulls the reset line low, pausing, then pulling the reset line high. A software reset writes a 0x12 then 0x34 to the REG_RESET as outlined in the datasheet.
290+
### reset(bool hardware)
291+
This function resets the SX1509 - either a hardware reset or software. A hardware reset (hardware parameter = 1) pulls the reset line low, pausing, then pulling the reset line high. A software reset writes a 0x12 then 0x34 to the REG_RESET as outlined in the datasheet.
279292

280293
Input:
281294

282295
* *hardware*: 0 executes a software reset, 1 executes a hardware reset.
283296

284-
**configClock(byte oscSource, byte oscPinFunction, byte oscFreqOut, byte oscDivider)**: This function configures the oscillator source/speed and the clock, which is used to drive LEDs and time debounces.
297+
### configClock(byte oscSource, byte oscPinFunction, byte oscFreqOut, byte oscDivider)
298+
This function configures the oscillator source/speed and the clock, which is used to drive LEDs and time debounces.
285299

286300
Inputs:
287301

@@ -298,7 +312,8 @@ Inputs:
298312
* ClkX = fOSC / (2^(RegMisc[6:4] -1))
299313
* This value defaults to 1.
300314

301-
**sync()**: Resets the PWM/Blink/Fade counters, syncing any blinking LEDs. Bit 2 of REG_MISC is set, which alters the functionality of the nReset pin. The nReset pin is toggled low->high, which should reset all LED counters. Bit 2 of REG_MISC is again cleared, returning nReset pin to POR functionality.
315+
### sync()
316+
Resets the PWM/Blink/Fade counters, syncing any blinking LEDs. Bit 2 of REG_MISC is set, which alters the functionality of the nReset pin. The nReset pin is toggled low->high, which should reset all LED counters. Bit 2 of REG_MISC is again cleared, returning nReset pin to POR functionality.
302317

303318
No inputs or outputs. Just does.
304319

@@ -310,4 +325,4 @@ If you do make use of the library, or if you find places for improvement, I'd lo
310325

311326
Thanks for checking this out.
312327

313-
Snooch.
328+
Snooch.

0 commit comments

Comments
 (0)