mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 07:38:35 -07:00
Temporarily backport app updates from apps repo
This commit is contained in:
@@ -6,6 +6,8 @@ App(
|
||||
cdefines=["APP_NRF24SCAN"],
|
||||
requires=["gui"],
|
||||
stack_size=2 * 1024,
|
||||
order=60,
|
||||
resources="resources",
|
||||
fap_icon="nrf24scan_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_private_libs=[
|
||||
|
||||
@@ -57,8 +57,7 @@ uint8_t nrf24_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data)
|
||||
return rx[0];
|
||||
}
|
||||
|
||||
uint8_t
|
||||
nrf24_write_buf_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data, uint8_t size) {
|
||||
uint8_t nrf24_write_buf_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data, uint8_t size) {
|
||||
uint8_t tx[size + 1];
|
||||
uint8_t rx[size + 1];
|
||||
memset(rx, 0, size + 1);
|
||||
@@ -207,11 +206,7 @@ uint8_t nrf24_set_packetlen(FuriHalSpiBusHandle* handle, uint8_t len) {
|
||||
return status;
|
||||
}
|
||||
|
||||
uint8_t nrf24_rxpacket(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
uint8_t* packet,
|
||||
uint8_t* ret_packetsize,
|
||||
uint8_t packet_size) {
|
||||
uint8_t nrf24_rxpacket(FuriHalSpiBusHandle* handle, uint8_t* packet, uint8_t* ret_packetsize, uint8_t packet_size) {
|
||||
uint8_t status = 0;
|
||||
uint8_t tx_cmd[33] = {0}; // 32 max payload size + 1 for command
|
||||
uint8_t tmp_packet[33] = {0};
|
||||
@@ -225,15 +220,13 @@ uint8_t nrf24_rxpacket(
|
||||
if(status & RX_DR) {
|
||||
if(packet_size == 1)
|
||||
packet_size = nrf24_get_packetlen(handle, (status >> 1) & 7);
|
||||
else if(packet_size == 0) {
|
||||
tx_cmd[0] = R_RX_PL_WID;
|
||||
tx_cmd[1] = 0;
|
||||
else if(packet_size == 0){
|
||||
tx_cmd[0] = R_RX_PL_WID; tx_cmd[1] = 0;
|
||||
nrf24_spi_trx(handle, tx_cmd, tmp_packet, 2, nrf24_TIMEOUT);
|
||||
packet_size = tmp_packet[1];
|
||||
}
|
||||
if(packet_size > 32 || packet_size == 0) packet_size = 32;
|
||||
tx_cmd[0] = R_RX_PAYLOAD;
|
||||
tx_cmd[1] = 0;
|
||||
tx_cmd[0] = R_RX_PAYLOAD; tx_cmd[1] = 0;
|
||||
nrf24_spi_trx(handle, tx_cmd, tmp_packet, packet_size + 1, nrf24_TIMEOUT);
|
||||
memcpy(packet, &tmp_packet[1], packet_size);
|
||||
nrf24_write_reg(handle, REG_STATUS, RX_DR); // clear RX_DR
|
||||
@@ -263,8 +256,7 @@ uint8_t nrf24_txpacket(FuriHalSpiBusHandle* handle, uint8_t* payload, uint8_t si
|
||||
nrf24_set_tx_mode(handle);
|
||||
|
||||
uint32_t start_time = furi_get_tick();
|
||||
while(!(status & (TX_DS | MAX_RT)) && furi_get_tick() - start_time < 2000UL)
|
||||
status = nrf24_status(handle);
|
||||
while(!(status & (TX_DS | MAX_RT)) && furi_get_tick() - start_time < 2000UL) status = nrf24_status(handle);
|
||||
|
||||
if(status & MAX_RT) nrf24_flush_tx(handle);
|
||||
|
||||
@@ -549,8 +541,9 @@ uint8_t nrf24_find_channel(
|
||||
return ch;
|
||||
}
|
||||
|
||||
uint8_t nrf24_set_mac(uint8_t mac_addr, uint8_t* mac, uint8_t mlen) {
|
||||
uint8_t nrf24_set_mac(uint8_t mac_addr, uint8_t *mac, uint8_t mlen)
|
||||
{
|
||||
uint8_t addr[5];
|
||||
for(int i = 0; i < mlen; i++) addr[i] = mac[mlen - i - 1];
|
||||
return nrf24_write_buf_reg(nrf24_HANDLE, mac_addr, addr, mlen);
|
||||
}
|
||||
for(int i = 0; i < mlen; i++) addr[i] = mac[mlen - i - 1];
|
||||
return nrf24_write_buf_reg(nrf24_HANDLE, mac_addr, addr, mlen);
|
||||
}
|
||||
@@ -47,9 +47,9 @@ extern "C" {
|
||||
#define RX_PW_P3 0x14
|
||||
#define RX_PW_P4 0x15
|
||||
#define RX_PW_P5 0x16
|
||||
#define RX_DR 0x40
|
||||
#define TX_DS 0x20
|
||||
#define MAX_RT 0x10
|
||||
#define RX_DR 0x40
|
||||
#define TX_DS 0x20
|
||||
#define MAX_RT 0x10
|
||||
|
||||
#define nrf24_TIMEOUT 500
|
||||
#define nrf24_CE_PIN &gpio_ext_pb2
|
||||
@@ -276,11 +276,8 @@ uint8_t nrf24_set_dst_mac(FuriHalSpiBusHandle* handle, uint8_t* mac, uint8_t siz
|
||||
*
|
||||
* @return device status
|
||||
*/
|
||||
uint8_t nrf24_rxpacket(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
uint8_t* packet,
|
||||
uint8_t* ret_packetsize,
|
||||
uint8_t packet_size_flag);
|
||||
uint8_t
|
||||
nrf24_rxpacket(FuriHalSpiBusHandle* handle, uint8_t* packet, uint8_t* ret_packetsize, uint8_t packet_size_flag);
|
||||
|
||||
/** Sends TX packet
|
||||
*
|
||||
@@ -316,7 +313,7 @@ void nrf24_configure(
|
||||
bool disable_aa);
|
||||
|
||||
// Set mac address (MSB first), Return: Status
|
||||
uint8_t nrf24_set_mac(uint8_t mac_addr, uint8_t* mac, uint8_t mlen);
|
||||
uint8_t nrf24_set_mac(uint8_t mac_addr, uint8_t *mac, uint8_t mlen);
|
||||
|
||||
/** Configures the radio for "promiscuous mode" and primes it for rx
|
||||
* This is not an actual mode of the nrf24, but this function exploits a few bugs in the chip that allows it to act as if it were.
|
||||
@@ -384,4 +381,4 @@ uint32_t bytes_to_int32(uint8_t* bytes, bool bigendian);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
2
applications/external/nrf24scan/nrf24scan.c
vendored
2
applications/external/nrf24scan/nrf24scan.c
vendored
@@ -1636,8 +1636,8 @@ int32_t nrf24scan_app(void* p) {
|
||||
}
|
||||
}
|
||||
|
||||
view_port_update(APP->view_port);
|
||||
furi_mutex_release(plugin_state->mutex);
|
||||
view_port_update(APP->view_port);
|
||||
}
|
||||
nrf24_set_idle(nrf24_HANDLE);
|
||||
if(log_arr_idx && (log_to_file == 1 || log_to_file == 2)) {
|
||||
|
||||
7
applications/external/nrf24scan/resources/apps_data/nrf24scan/addr-CO2mini.txt
vendored
Normal file
7
applications/external/nrf24scan/resources/apps_data/nrf24scan/addr-CO2mini.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Rate: 1
|
||||
Ch: 122
|
||||
ESB: 1
|
||||
DPL: 0
|
||||
CRC: 2
|
||||
Payload: 4
|
||||
P0: C8C8C1
|
||||
7
applications/external/nrf24scan/resources/apps_data/nrf24scan/addr-WCO1.txt
vendored
Normal file
7
applications/external/nrf24scan/resources/apps_data/nrf24scan/addr-WCO1.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Rate: 1
|
||||
Ch: 120
|
||||
ESB: 1
|
||||
DPL: 1
|
||||
CRC: 2
|
||||
Payload: 4
|
||||
P0: C8C8E5
|
||||
11
applications/external/nrf24scan/resources/apps_data/nrf24scan/addresses.txt
vendored
Normal file
11
applications/external/nrf24scan/resources/apps_data/nrf24scan/addresses.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
Rate: 1
|
||||
Ch: 2
|
||||
ESB: 1
|
||||
DPL: 0
|
||||
CRC: 2
|
||||
Payload: 4
|
||||
P0: C8C8C0
|
||||
P1: C8C8C1
|
||||
P2: C2
|
||||
P3: C3
|
||||
P4: E5
|
||||
5
applications/external/nrf24scan/resources/apps_data/nrf24scan/sniff.txt
vendored
Normal file
5
applications/external/nrf24scan/resources/apps_data/nrf24scan/sniff.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
SNIFF
|
||||
ESB: 1
|
||||
CRC: 2
|
||||
P0: 00AA
|
||||
P1: 0055
|
||||
Reference in New Issue
Block a user