nRF52832
www.szrfstar.com V1.3 - Sep., 2020
Shenzhen RF-star Technology Co., Ltd. Page 50 of 58
9. Master Reference Code (Transparent Transmission)
Logical relationship: The module uses two IO ports of BCTS, BRTS to send and receive notification and control. These
two IOs are in high level and will be triggered when put low in normal. If the module has data to send, BCTS will be set
low to inform the microcontroller to receive. If the microcontroller has data to send, BRTS will set low to notification
module to receive. The schematic code is as follows:
void main(void)
{
//Wait for the module start
While(!memcmp(mcu_uart_read_data0(),”DEVICE_START\r\n”,strlen(“DEVICE_START\r\n”)));
//Enable RTX, that is, MCU can receive date from BLE module
set_rts_enable();
//Delay for 50 ms
mcu_delay_ms(50));
While(1){
//Aquire whether the CTS status is loe level
If(get_cts_state()==0){
//Print the data sent from BLE
Mcu_printf_string(mcu-uart_read_data());
}
//Delay for 50 ms
Mcu_delay-ms(50);
//Send test data to BLE
Mcu_send_to_ble_string(Test data.\r\n”);
}
}