Initialization
gollumRfSetRfConfigPredefined
Programs the full list of RF parameter in 1 step, using a predefined RF configuration.
TODO: add predefined RF configuration details
| Parameters |
Type |
Role |
| configId |
unsigned int |
Id of the predefined RF configuration to use |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetRfConfigPredefined(0);
gollumRfSetupConfig
Initialization of Gollum Native Library CC1111 configuration structure.
Used before other PandwaRF JS functions to query the state of CC1111 HW registers and cache it internally. This shall speed up subsequent CC1111 HW registers. However, it can be omitted.
If used, shall be done before dongle initialization.
Optional.
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetupConfig();
gollumRfInitDongle();
gollumRfSetModulation(mod, invert);
gollumRfInitDongle
Dongle initialization functions.
If used, shall be done after CC1111 configuration structure initialization (gollumRfSetupConfig).
It is equivalent to:
- gollumRfSetFrequency(433920000)
- SetMdmSyncMode(CS carrier-sense above threshold)
- SetMdmSyncWord()
- SetPktPQT(0)
- MakePktFlen(250 bytes)
- SetPktDataWhitening(Disabled)
- SetMdmFEC(Disabled)
- SetPktCRC(Disabled)
- SetRxSensitivity(Default)
- SetRxFilterBW(Default)
Optional.
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetupConfig();
gollumRfInitDongle();
gollumRfSetModulation(mod, invert);
Setup
gollumRfSetFrequency
Sets the TX/RX frequency of CC1111
| Parameters |
Type |
Role |
| freq |
unsigned int |
Frequency in Hz |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetFrequency(435000000);
gollumRfSetOutputPower
Sets the CC1111 'standard' output power
For more complex power shaping this will need to be done manually.
| Parameters |
Type |
Role |
| power |
unsigned int |
Output power as defined in table below |
| Output Power (dBm) |
315 MHz |
433 MHz |
868 MHz |
915 MHz |
| –30 |
0x12 |
0x12 |
0x03 |
0x03 |
| –20 |
0x0D |
0x0E |
0x0E |
0x0D |
| –15 |
0x1C |
0x1D |
0x1E |
0x1D |
| –10 |
0x34 |
0x34 |
0x27 |
0x26 |
| –5 |
0x2B |
0x2C |
0x8F |
0x57 |
| 0 |
0x51 |
0x60 |
0x50 |
0x8E |
| 5 |
0x85 |
0x84 |
0x84 |
0x83 |
| 7 |
0xCB |
0xC8 |
0xCB |
0xC7 |
| 10 |
0xC2 |
0xC0 |
0xC2 |
0xC0 |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetFrequency(433000000);
gollumRfSetOutputPower(0x60); // Sets output power to 0dBm
gollumRfSetBitRate
Sets the CC1111 Data Rate
| Parameters |
Type |
Role |
| datarate |
unsigned int |
Data rate in bits/s |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetBitRate(2500);
gollumRfSetModulation
Sets the CC1111 Modulation
| Parameters |
Type |
Role |
| mod |
unsigned int |
Modulation value |
| Modulation |
Value |
| MOD_2FSK |
0x00 |
| MOD_4FSK |
0x40 |
| MOD_GFSK |
0x10 |
| MOD_ASK_OOK |
0x30 |
| MOD_MSK |
0x70 |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
//MOD_2FSK = 0x00
//MOD_4FSK = 0x40
//MOD_GFSK = 0x10
//MOD_ASK_OOK = 0x30
//MOD_MSK = 0x70
gollumRfSetModulation(0x30);
gollumRfSetFilterBandwidth
Sets the CC1111 RX filter bandwidth
| Parameters |
Type |
Role |
| bandwidth |
unsigned int (32 bits) |
Bandwidth, in Hz, min 53571 max 812500 |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetFilterBandwidth(100000);
gollumRfSetMaxPower
Sets the CC1111 max transmit power
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetMaxPower(0x0E); // Max TX power is -20dBm
Transmission
gollumRfTxSetup
Config radio before sending Tx message over radio interface
| Parameters |
Type |
Role |
| freq |
uint32_t |
frequence |
| modulation |
uint8_t |
modulation. Cf gollumRfSetModulation |
| drate |
uint32_t |
Data rate |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfTxSetup(433913879, 0, 3200); // Transmit on 433MHz at 3200 bits/s using 2-FSK modulation
gollumRfSend0 (disabled, do not use)
Sends a data 0
| Parameters |
Type |
Role |
| duration |
int |
duration of the data (us) |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSend1 (disabled, do not use)
Sends a data 1
| Parameters |
Type |
Role |
| duration |
int |
duration of the data (us) |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSendByte (disabled, do not use)
Sends a data byte
| Parameters |
Type |
Role |
| data |
unsigned char |
byte to transmit |
| duration_us |
unsigned int |
byte duration |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSendStream
Sends an array of data to the CC11xx
WARNING: Data is directly sent without conversion.
| Parameters |
Type |
Role |
| data |
Array of unsigned char |
Array of data to send |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSendStream("test");
gollumRfSendStream([ 0x80, 0x00, 0x00, 0x00 ]);
gollumRfTxFlush
Flushes the TX FIFO
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfTxFlush();
gollumRfTxSend
Send TX message over radio interface
| Parameters |
Type |
Role |
| data |
String |
buffer containing data to Transmit |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
var string = "\x88\x8e\x88";
var size = 20;
var freq = 433920000;
var mod = 0x30;
var drate = 3200;
gollumRfTxSetup(freq, mod, drate);
gollumRfTxSend("" + string);
gollumRfTxSendRepeat
Send TX message asynchronously over radio interface with repetition
| Parameters |
Type |
Role |
| data_buffer |
String |
data to be sent |
| repeat |
uint16_t |
number of repeat times, CC1111 RF firmware handles repetition |
| offset |
uint16_t |
repeat from byte number 'offset' |
| delay |
uint16_t |
delay in ms between each transmission |
| transmit_times |
uint16_t |
number of time to repeat data_buffer |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
var word = "\xB2\xCB\x2C\xB2\xC8\x00\x00\x00\x00";
gollumRfSetupConfig();
gollumRfSetModulation(mod, invert);
gollumRfSetBitRate(rate);
gollumRfSetMaxPower(0);
gollumRfTxSendRepeat(word, 10, 0, 0, 1);
gollumRfXmitAsync (Deprecated)
Send TX message asynchronously over radio interface with repetition.
Deprecated. Use gollumRfTxSendRepeat() instead.
| Parameters |
Type |
Role |
| data_buffer |
String |
data to be sent |
| repeat |
uint16_t |
number of repeat times, CC1111 RF firmware handles repetition |
| offset |
uint16_t |
repeat from byte number 'offset' |
| delay |
uint16_t |
delay in ms between each transmission |
| transmit_times |
uint16_t |
number of time to repeat data_buffer |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
var word = "\xB2\xCB\x2C\xB2\xC8\x00\x00\x00\x00";
gollumRfSetupConfig();
gollumRfSetModulation(mod, invert);
gollumRfSetBitRate(rate);
gollumRfSetMaxPower(0);
gollumRfXmitAsync(word, 10, 0, 0, 1);
gollumRfStartRfJamming
Sends a single msg to start frequency jamming
| Parameters |
Type |
Role |
| baseFreq |
uint32_t |
Base frequency in Hz |
| datarate |
uint32_t |
Data rate for TX in Hz |
| mod |
uint16_t |
Modulation |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
var baseFreq = 434000000;
var rate = 25449;
var mod = 0x30;
gollumPrint("-- Start RF jamming --");
gollumRfStartRfJamming(baseFreq, rate, mod);
gollumRfSleep(6000000); // in microseconds
gollumRfStopRfJamming();
gollumPrint("-- Stop RF jamming --");
gollumRfStopRfJamming
Sends a single msg to stop frequency jamming
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
var baseFreq = 434000000;
var rate = 25449;
var mod = 0x30;
gollumPrint("-- Start RF jamming --");
gollumRfStartRfJamming(baseFreq, rate, mod);
gollumRfSleep(6000000); // in microseconds
gollumRfStopRfJamming();
gollumPrint("-- Stop RF jamming --");
Reception
gollumRfRxListen
Allocates memory, and fills the given buffer with radio data
| Parameters |
Type |
Role |
| bufsize |
int |
size to allocate to the buffer |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
data = gollumRfRxListen(100); // 100 is the size to allocate to the RX buffer
gollumRfRxStop
Stops RX data reception
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfRxStop();
gollumRfRxSetup
Configures PandwaRF for data reception
| Parameters |
Type |
Role |
| freq |
uint32_t |
frequence |
| modulation |
uint8_t |
modulation. Cf gollumRfSetModulation |
| drate |
uint32_t |
Data rate |
| flen |
uint8_t |
frame length. Size (in bytes) of the packet that the CC1111 transceiver needs to capture before sending it to Android |
| channelBw |
uint32_t |
Receiver Channel Filter Bandwidth (Hz). If 0: calculates the optimal ChanBW setting for the current freq/baud |
| deviation |
uint32_t |
Channel deviation, in Hz. Only used for 2-FSK/GFSK/MSK. |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfRxSetup(433913879, 0, 3200, 50);
CC1111
gollumRfResetRadioChip
SW reset of CC1111
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfResetRadioChip();
gollumRfGetBuildType
Return the build type of the dongle
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| BuildType |
String |
build type of the dongle |
Usage:
gollumPrint("Build type is: " + gollumRfGetBuildType());
gollumGetCC1111RfRegisters
Returns the names and values of cc1111 registers
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| data[0] |
String[] |
Register Names |
| data[1] |
String[] |
Register Values |
Usage:
var values, names, i;
var res = gollumGetCC1111RfRegisters();
names = res[0];
values = res[1];
for (i = 0; i < names.length; i++) {
gollumPrint("" + names[i] + " - " + values[i]);
}
gollumRfRegisterRead
Read the radio registers starting at addr (first setting RF state to IDLE, then returning to RX/TX)
| Parameters |
Type |
Role |
| addr |
uint16_t |
register start address |
| length |
uint16_t |
number of register to read |
| Return value |
Type |
Role |
| Object array |
Object array |
object containing the data read |
Usage:
var s = gollumRfRegisterRead(0xDF01, 5); // we start to read registers a "0xDF01",
// and we finally read 5 registers
var i;
for(i = 0; i < s.length; i++){
gollumPrint("Value read - "+ s[i].toString(16));
}
gollumRfRegisterWrite
Set the radio register 'addr' to 'data' (first setting RF state to IDLE, then returning to RX/TX)
| Parameters |
Type |
Role |
| data |
String |
register value to write(array of bytes) |
| addr |
uint16_t |
register address |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumPrint("---------- Before writting registers --------- ");
var before =
gollumRfRegisterRead(0xDF01, 5); // we start to read registers a "0xDF01",
// and we finally read 5 registers
for (var z = 0; z < before.length; z++) {
gollumPrint("Value read - " + before[z].toString(16));
}
var values = [ 0xAB, 0xEF, 0xFF ]; // values in hexa
gollumRfRegisterWrite(values, 0xDF01); // we start to write a value at
// register which has address "0xDF01",
// We write in 3 registers
gollumPrint("---------- After writting registers --------- ");
var after =
gollumRfRegisterRead(0xDF01, 5); // we start to read registers a "0xDF01",
// and we finally read 5 registers
for (var i = 0; i < after.length; i++) {
gollumPrint("Value read - " + after[i].toString(16));
}
System
gollumRfDelay (disabled, do not use)
Disabled
| Parameters |
Type |
Role |
| delay |
unsigned int |
duration of the delay (us) |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfDelay(100);
gollumRfSetLed
Sets the led
| Parameters |
Type |
Role |
| led_id |
ZZZ |
id of led |
| value |
ddd |
value that we will set. 0: OFF, 1: ON |
|
|
|
| Eye |
LED id |
Color |
| Right |
2 |
Orange LED |
| Right |
4 |
Blue LED |
| Left |
1 |
Green LED |
| Left |
3 |
Red LED |
Cf [ Hardware LEDs Indication State | Hardware-LEDs-Indication-State) for more details about LEDs.
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSetLed(2, 1); // Set LED 2 to ON
gollumRfCC1111Sleep
Sends a sleep command to the CC1111
| Parameters |
Type |
Role |
| pm |
uint16_t |
C1111 Power Management mode of the sleep (between 0 and 3) |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfCC1111Sleep(3); // Enters PM mode 3
gollumRfPing
Sends a ping in order to get an alive response
| Parameter |
Type |
Role |
| None |
- |
- |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfPing();
gollumPrint
Prints a string to the output console
| Parameters |
Type |
Role |
| str |
String |
string to print on the console of the smartphone |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
var a = gollumRfGetBuildType();
gollumPrint("Build version is: " + a);
gollumRfSleep
Pause the script execution during x microseconds
| Parameters |
Type |
Role |
| duration_us |
uint32_t |
duration to sleep |
| Return value |
Type |
Role |
| None |
- |
- |
Usage:
gollumRfSleep(1000 * 1000); // Sleep for 1s