Skip to content
Update API authored by Vince Mulhollon's avatar Vince Mulhollon
# API Notes # ulisp-seesaw implemented user API
## ulisp-seesaw implemented and tested API ## \*seesaw:i2c-address\*
If you have multiple seesaw devices in a project, you can change the mutable global variable \*seesaw:i2c-address\* between running functions to change the currently selected seesaw device.
digital-direction.lisp - Set direction and pullup/down mode of a pin. Example: ## seesaw:digital-direction
Set direction and pullup/down mode of a pin. Parameters:
<pre>
(seesaw:digital-direction pin direction-and-mode)
</pre>
Example:
<pre> <pre>
(seesaw:digital-direction 'PA10 'InputPullUp) (seesaw:digital-direction 'PA10 'InputPullUp)
</pre> </pre>
Would set pin PA10 to input mode with an internal pullup resistor
digital-read-p.lisp - Reads a bit from GPIO returning a T or NIL. Note, you should set the pin direction to input, before reading. Example: ## seesaw:digital-read-p
Reads a bit from GPIO returning a T or NIL. Note, you should set the pin direction to input, before reading. Example:
<pre> <pre>
(seesaw:digital-read-p 'PA10) (seesaw:digital-read-p 'PA10)
</pre> </pre>
i2c-address.lisp - All installations require this variable to be defined to configure the chip I2C addrs. If you have multiple devices in a project, you can change the mutable global variable \*seesaw:i2c-address\* on the fly between running functions. ## seesaw:id-read
Read the hardware ID of the chip, which should always be 0x55 aka 85 decimal. Example:
id-read.lisp - Read the hardware ID of the chip, which should always be 0x55 aka 85 decimal. Example:
<pre> <pre>
(seesaw:id-read) (seesaw:id-read)
</pre> </pre>
reset.lisp - Software reset the seesaw chip. Example: ## seesaw:reset
Software reset the seesaw chip. Example:
<pre> <pre>
(seesaw:reset) (seesaw:reset)
</pre> </pre>
pwm.lisp - Set a pin to output a PWM signal. Some percentages have convenience quotes. Example, to set an Adafruit (tm) TFTv2 backlight to half brightness: ## seesaw:pwm
Set a pin to output a PWM signal. Percentages have convenience quotes. Example, to set an Adafruit (tm) TFTv2 backlight to half brightness:
<pre> <pre>
(seesaw:pwm 'PA04 'half) (seesaw:pwm 'PA04 'half)
</pre> </pre>