Getting started with the following setup for the external LED. I have the beacon bluetooth stack loaded on the R41Z board.
gpio_pins.c
/* Declare Output GPIO pins */
gpioOutputPinConfig_t ledPins[] = {
{
.
.
.
{
.gpioPort = gpioPort_C_c,
.gpioPin = 18,
.outputLogic = 1,
.slewRate = pinSlewRate_Slow_c,
.driveStrength = pinDriveStrength_High_c
}
};
gpioOutputPinConfig_t appExternalLed = {
.gpioPort = gpioPort_B_c,
.gpioPin = 18,
.outputLogic = 1,
.slewRate = pinSlewRate_Slow_c,
.driveStrength = pinDriveStrength_Low_c
};
-------
gpio_pins.h
.
.
.
extern gpioInputPinConfig_t switchPins[];
extern gpioOutputPinConfig_t ledPins[];
extern gpioOutputPinConfig_t appExternalLed;
------
pin_mux.c
#include "gpio_pins.h"
/*FUNCTION**********************************************************************
*
* Function Name : APP_InitExternalLED
* Description : Configures gpio output for external LEDs
* Called in LED.c file to initialize
*
*END**************************************************************************/
void APP_InitExternalLED(void) {
GpioOutputPinInit(&appExternalLed, 1);
GpioClearPinOutput(&appExternalLed); // LED is off at start up
}
------
pin_mux.h
/*!
* @brief Configures pin routing and optionally pin electrical features.
*
*/
void APP_InitExternalLed(void);
-------
LED.c
/******************************************************************************
******************************************************************************
* Public functions
******************************************************************************
*****************************************************************************/
/******************************************************************************
* Name: LED_Init
* Description: Initialize the LED module
* Parameters: -
* Return: -
******************************************************************************/
void LED_Init
(
void
)
{
APP_InitExternalLED();
.
.
.
BOARD_InitLEDs();
(void)GpioOutputPinInit(ledPins, gLEDsOnTargetBoardCnt_c);
.
.
I think that sets up my LED connection and initialization at PTB18. I'm trying to understand how I can detect the advertisement from the board on a custom BLE mobile app. The only way I can see the device from my mobile phone is using the IoT Toolbox app NXP and booting up the Beacon program within. What would I need to modify in the beacon software stack to see the BLE advertisement on a custom BLE mobile app?
I have a template BLE app "BluetoothLeGatt" provided from Android Studios which just does a scan of nearby devices and currently nothing shows up.

I also have a LEDController Sample App but it first needs to pair to the R41Z device before I can use the on/off functionality.


After I am able to pair the devices the next step would be to read the message of a "HIGH" or "LOW" signal sent from the mobile app.
The functions in the LEDControllerSample app sending these commands are defined as following:
private void turnOffLed()
{
if (btSocket!=null)
{
try
{
btSocket.getOutputStream().write("0".toString().getBytes());
}
catch (IOException e)
{
msg("Error");
}
}
}
private void turnOnLed()
{
if (btSocket!=null)
{
try
{
btSocket.getOutputStream().write("1".toString().getBytes());
}
catch (IOException e)
{
msg("Error");
}
}
}Also, in the source code of the mobile app there is this line:
static final UUID myUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");Does this UUID need to be changed to the matching R41Z board?