User Manual
Table Of Contents
- INTRODUCTION
- CONTROLLING THE ACCESS SERVER
- CONFIGURATION
- USING THE SYSTEM
- BLUETOOTH TECHNOLOGY OVERVIEW
- INTRODUCTION TO SDK
- INSTALLING THE WRAP SOFTWARE DEVELOPMENT ENVIRONMENT
- CREATING WRAP APPLICATIONS
- BLUETOOTH SERVER SOCKET INTERFACE
- I/O API
- ABOUT BLUEGIGA
- APPENDIX A – WRAP DIRECTORY STRUCTURE
USER'S AND DEVELOPER'S GUIDE WRAP MULTIRADIO ACCESS SERVER
10 I/O API
The Bluegiga I/O API (Application Programming Interface) defines how to access the WRAP
general purpose I/O (P1), A/D converter (JP2 & JP3), DIP switches (SW2), and LEDs (D1-D8)
and contains functions to accomplish this.
The I/O API is accessed by using functions, macros, and constants defined in the header file
bgio.h. You can use the macros by including the file.
Example:
#include <bgio.h>
10.1 LED/BUZZER API
WRAP LEDs are controlled by using the following macros and functions. You need to add an
extra linker flag "LDFLAGS = -lbgio" to your Makefile when using the LED API.
#include <bgio.h>
BGIO_LED(int lednum)
BGIO_LED returns ledmask for lednum. lednum is the number of LED in the range 0
(D1) to BGIO_LED_MAX (D8).
int bgio_led_status(void)
bgio_led_status reads LEDs and returns current ledmask.
void bgio_led_set(int ledmask)
bgio_led_set sets LEDs in ledmask ON.
void bgio_led_clr(int ledmask)
bgio_led_clr sets LEDs in ledmask OFF.
ledmask is a bit mask where bit 0 is LED 0 (D1), bit 1 is LED 1 (D2), etc..
See src/examples/io/led/ for a LED API example.
LEDs and the buzzer can also be accessed via "/dev/led". You can check the status of the LEDs
and buzzer with "cat /dev/led" command and set LEDs or buzzer with "echo abcde > /dev/led"
command. A letter in upper case means that the LED or buzzer is ON, lower case means that
the LED or buzzer is OFF. Letter "a" is the buzzer, letters "b".."e" are LEDs 1..4.
10.2 GPIO API
Not yet available.
Bluegiga Proprietary, Copyright © Bluegiga Technologies 2001-2004 90 (94)