Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DISCO_IOT-wifi_client
Fork of stm-spirit1-rf-driver by
Diff: SimpleSpirit1.h
- Revision:
- 8:10967c884e38
- Parent:
- 7:e90fa8f6bc6c
- Child:
- 9:3db68ab23070
--- a/SimpleSpirit1.h Fri Oct 21 14:56:55 2016 +0200
+++ b/SimpleSpirit1.h Mon Oct 24 08:34:33 2016 +0200
@@ -74,9 +74,8 @@
/** Status Variables from Cube Implementation **/
volatile uint8_t receiving_packet;
volatile unsigned int spirit_on;
- int just_got_an_ack;
- uint16_t last_rssi; //MGR
- uint16_t last_lqi; //MGR
+ uint8_t last_rssi; //MGR
+ uint8_t last_lqi; //MGR
/** Low Level Instance Variables **/
unsigned int _nr_of_irq_disables;
@@ -209,8 +208,8 @@
}
float qi_get_rssi_dbm() {
- last_rssi = SpiritQiGetRssi();
- return (-120.0+((float)(last_rssi-20))/2);
+ last_rssi = qi_get_rssi();
+ return get_last_rssi_dbm();
}
uint8_t qi_get_rssi() {
@@ -306,7 +305,11 @@
~SimpleSpirit1(void); // should never be called!
private:
+#ifdef CONTIKI // betzw - TODO
/*** Original Contiki APIs & Variables ***/
+ /** Interrupt callback just detected an ack **/
+ int just_got_an_ack;
+
/** Variable(s) for Original API(s) **/
int packet_is_prepared;
@@ -323,6 +326,7 @@
}
return transmit_contiki(payload_len);
}
+#endif // CONTIKI
public:
static SimpleSpirit1& CreateInstance(PinName mosi, PinName miso, PinName sclk,
@@ -362,6 +366,11 @@
int on(void);
int off(void);
+ /** Set Channel **/
+ void set_channel(uint8_t channel) {
+ SpiritRadioSetChannel(channel);
+ }
+
/** Send a Buffer **/
int send(const void *payload, unsigned int payload_len);
@@ -383,12 +392,12 @@
int get_pending_packet(void);
/** Get latest value of RSSI **/
- uint16_t get_last_rssi(void) {
- return last_rssi;
+ float get_last_rssi_dbm(void) {
+ return (-120.0+((float)(last_rssi-20))/2);
}
/** Get latest value of LQI **/
- uint16_t get_last_lqi(void) {
+ uint8_t get_last_lqi(void) {
return last_lqi;
}
};
