Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
rfm23.h
Go to the documentation of this file.
1
6#ifndef _RFM23_H
7#define _RFM23_H
8
9#include "debug.h"
10#include <RHHardwareSPI1.h>
11#include <RH_RF22.h>
12#include <TeensyThreads.h>
13#include <support/packetcomm.h>
14
15#undef RH_RF22_MAX_MESSAGE_LEN
21#define RH_RF22_MAX_MESSAGE_LEN 50
22
23namespace Artemis {
24 namespace Devices {
26 class RFM23 {
27 public:
41 struct __attribute__((packed)) rfm23_config {
47 uint16_t freq;
76 uint8_t tx_power;
77
87 struct pins {
89 uint8_t spi_miso;
91 uint8_t spi_mosi;
93 uint8_t spi_sck;
95 uint8_t nirq;
97 uint8_t cs;
99 uint8_t tx_on;
101 uint8_t rx_on;
102 } pins;
112 };
123 RFM23(uint8_t slaveSelectPin, uint8_t interruptPin,
124 RHGenericSPI &spi = hardware_spi1);
125 int32_t reset();
126 int32_t init(rfm23_config cfg, Threads::Mutex *mtx);
127 int32_t send(PacketComm &packet);
128 int32_t recv(PacketComm &packet, uint16_t timeout);
129 int32_t set_tx_power(uint8_t power);
130 int32_t get_tsen();
131 int32_t read_rssi();
132
133 private:
145 RH_RF22 rfm23;
154 Threads::Mutex *spi_mtx;
163 rfm23_config config;
164 };
165 } // namespace Devices
166} // namespace Artemis
167
168#endif // _RFM23_H
The satellite's RFM23 radio.
Definition rfm23.h:26
int32_t set_tx_power(uint8_t power)
Sets the transmit power of the RFM23 radio.
Definition rfm23.cpp:270
int32_t reset()
Resets the RFM23 radio.
Definition rfm23.cpp:133
int32_t get_tsen()
Gets the RFM23's temperature.
Definition rfm23.cpp:289
int32_t init(rfm23_config cfg, Threads::Mutex *mtx)
Initialization of the RFM23 radio.
Definition rfm23.cpp:35
int32_t recv(PacketComm &packet, uint16_t timeout)
Receive a packet using the RFM23 radio.
Definition rfm23.cpp:212
int32_t read_rssi()
Gets the Received Signal Strength Indicator (RSSI).
Definition rfm23.cpp:304
int32_t send(PacketComm &packet)
Transmit a packet using the RFM23 radio.
Definition rfm23.cpp:151
Definitions of Serial Console helper functions.
The pins used to connect the RFM23 to the Teensy.
Definition rfm23.h:87
uint8_t cs
The chip select pin.
Definition rfm23.h:97
uint8_t rx_on
The receive on pin.
Definition rfm23.h:101
uint8_t spi_miso
The Master In, Slave Out (MISO) pin.
Definition rfm23.h:89
uint8_t tx_on
The transmit on pin.
Definition rfm23.h:99
uint8_t nirq
The interrupt pin.
Definition rfm23.h:95
uint8_t spi_mosi
The Master Out, Slave In (MOSI) pin.
Definition rfm23.h:91
uint8_t spi_sck
The SPI clock pin.
Definition rfm23.h:93
The RFM23 configuration structure.
Definition rfm23.h:41
uint16_t freq
The operating frequency of the radio in MHz.
Definition rfm23.h:47
uint8_t tx_power
The transmitter power level in dBm.
Definition rfm23.h:76