#include "sceptre.h"
#include "bluetooth.h"
#include "btm222.h"
Go to the source code of this file.
Defines | |
#define | BLUETOOTH_PIN 18 |
Bluetooth module power control is on pin P1.18. | |
#define | BLUETOOTH_POWER_OFF IOSET1 = (1<<BLUETOOTH_PIN) |
#define | BLUETOOTH_POWER_ON IOCLR1 = (1<<BLUETOOTH_PIN) |
Functions | |
void | bluetooth_power (int power) |
bool_t | bluetooth_init (int baudrate) |
bool_t | bluetooth_set_friendly_name (char *p_name) |
bool_t | bluetooth_set_pin (char *p_pin) |
int | bluetooth_send (char *p_data, int data_size) |
uint8_t | bluetooth_scan (void) |
bool_t | bluetooth_connect (bool_t as_slave, char *p_pin, uint8_t device, uint32_t timeout_ms, bool_t reconnect) |
bool_t | bluetooth_is_connected (void) |
void | bluetooth_get_module_info (void) |
High-level Bluetooth driver implementation.
Definition in file bluetooth.c.
bool_t bluetooth_connect | ( | bool_t | as_slave, | |
char * | p_pin, | |||
uint8_t | device, | |||
uint32_t | timeout_ms, | |||
bool_t | reconnect | |||
) |
Try to connect to another Bluetooth device.
as_slave | true for connecting as slave (passive), false for master. | |
p_pin | ID as ASCII string. | |
device | Number of the device (1..8) to connect to (master mode only). | |
timeout_ms | Time (ms) to wait (block) for a connection. | |
reconnect | Keep a background connection "thread" running (slave mode only). |
Definition at line 117 of file bluetooth.c.
void bluetooth_get_module_info | ( | void | ) |
Get some information concerning the Bluetooth module.
Definition at line 152 of file bluetooth.c.
bool_t bluetooth_init | ( | int | baudrate | ) |
Initialize the Bluetooth driver.
baudrate | Speed of the serial port that talks to the BT module. |
Definition at line 45 of file bluetooth.c.
bool_t bluetooth_is_connected | ( | void | ) |
Check if this device is connected.
Definition at line 139 of file bluetooth.c.
void bluetooth_power | ( | int | power | ) |
Switch module power on or off.
power | BLUETOOTH_OFF or BLUETOOTH_ON. |
Definition at line 32 of file bluetooth.c.
uint8_t bluetooth_scan | ( | void | ) |
Do a search for other Bluetooth devices.
Definition at line 99 of file bluetooth.c.
int bluetooth_send | ( | char * | p_data, | |
int | data_size | |||
) |
Send data over the Bluetooth connection.
p_data | Pointer to the data to send. | |
data_size | Number of bytes to send. |
Definition at line 86 of file bluetooth.c.
bool_t bluetooth_set_friendly_name | ( | char * | p_name | ) |
Set the human readable name of the Bluetooth device.
p_name | Friendly name as ASCII string (16 characters max). |
Definition at line 59 of file bluetooth.c.
bool_t bluetooth_set_pin | ( | char * | p_pin | ) |
Set the pin (ID) code of the Bluetooth device.
p_pin | Pin (ID) as ASCII string (4 characters max). |
Definition at line 71 of file bluetooth.c.