TOOTHPIC RF Solutions, TOOTHPIC Datasheet - Page 18

MODULE, BLUETOOTH, DATA ACQUISITION

TOOTHPIC

Manufacturer Part Number
TOOTHPIC
Description
MODULE, BLUETOOTH, DATA ACQUISITION
Manufacturer
RF Solutions
Datasheet

Specifications of TOOTHPIC

Svhc
No SVHC (15-Dec-2010)
Page 18
3. Open the file ToothPIC303.c in development kit main directory and save it in your project directory.
4. Open the file Main.c which is in the development kit main directory and save it in your project
5. The first change to be made to HelloWorldBit.c is to tell the BlueMatik radio to enter slave mode
6. If a remote device connects to ToothPIC and then disconnects, ToothPIC will no longer be in slave
This file allows you to customize the ToothPIC Services for this specific application. In this case the
only modification required is to change the device name. Replace the line:
with the line:
Note the many other settings in the file: PIN codes, device classes, etc. You can modify the values
but it is very important that you do not modify the order or the size of these variable declarations. This
is because during Wireless Field Programming, your application code gets updated but the ToothPIC
Services do not.
directory with the name HelloWorldBit.c. This file is an ‘empty shell’ main application containing
all the functions you need to provide code for in your application. The ‘empty shell’ simply flashes
LEDs to indicate whether or not it is functioning correctly. Note how it contains a main function which
initializes and then runs in an infinite loop.
ErrorStatus, BMTEvent and FxPEvent are ‘callbacks’ which are called by ToothPIC services
when certain events occur. For example, the LowInterrupt is called once per second with the
interrupt flag SWI_Tick set. Main.c clears the flag – if it did not, ToothPIC would keep calling
LowInterrupt because it would assume that the interrupt had not yet been serviced.
so other devices can connect to it. Since this will also be necessary after each disconnection, the
static variable InSlaveMode will keep track of whether the slave mode command needs to be send.
Place the following line at the beginning of the file before the main declaration:
and insert the following code inside the infinite loop of the main function:
This will put the radio in slave mode whenever the flag InSlaveMode is not set.
mode, so it needs to be put back into slave mode again. To do this, a BMTE_Disco message is sent
to the BMTEvent callback when the remote device disconnects. At the same time, we will trap the
BMTE_Connect message and light the red LED when a remote device is connected. Add the
following code to the BMTEvent callback function:
9-Apr-06
rom unsigned char pLocalName[LOCALNAMELEN] = "ToothPIC 3.0";
rom unsigned char pLocalName[LOCALNAMELEN] = "Hello World Bit";
Bool InSlaveMode = False;
if (!InSlaveMode)
{
}
if ( EventID==BMTE_Connect )
{
}
if ( EventID==BMTE_Disco )
{
BMTCommand( BMTC_Slave, 0, 0 );
AwaitBMTOK;
InSlaveMode = True;
// turn on red led during connection
LedRed = LedRedOn;
// turn off red led after disconnection
LedRed = LedRedOff;
// re-enter slave mode
Toothpick 3.0.00007
DS380-8
// false if we need to send a BMTC_Slave command
© FlexiPanel Ltd
The functions HighInterrupt, LowInterrupt,
// Start BlueMatik binary service
Patents apply and/or pending
www.FlexiPanel.com

Related parts for TOOTHPIC