Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
rfm98.h
Go to the documentation of this file.
1
5#ifndef _RFM98_H
6#define _RFM98_H
7
8#include "debug.h"
9#include <RHHardwareSPI1.h>
10#include <RH_RF95.h>
11#include <TeensyThreads.h>
12#include <support/packetcomm.h>
13
14namespace Artemis {
15 namespace Devices {
17 class RFM98 {
18 public:
32 struct __attribute__((packed)) rfm98_config {
38 uint16_t freq;
47 uint8_t tx_power;
48
61 struct pins {
63 uint8_t spi_miso;
65 uint8_t spi_mosi;
67 uint8_t spi_sck;
69 uint8_t nirq;
71 uint8_t cs;
73 uint8_t reset;
74 } pins;
84 };
95 RFM98(uint8_t slaveSelectPin, uint8_t interruptPin,
96 RHGenericSPI &spi = hardware_spi1);
97 int32_t reset();
98 int32_t init(rfm98_config cfg, Threads::Mutex *mtx);
99 int32_t send(PacketComm &packet);
100 int32_t recv(PacketComm &packet, uint16_t timeout);
101
102 private:
114 RH_RF95 rfm98;
115
124 Threads::Mutex *spi_mtx;
125
134 rfm98_config config;
135 };
136 } // namespace Devices
137} // namespace Artemis
138
139#endif // _RFM98_H
The satellite's RFM98 radio.
Definition rfm98.h:17
int32_t send(PacketComm &packet)
Transmit a packet using the RFM98 radio.
Definition rfm98.cpp:115
int32_t recv(PacketComm &packet, uint16_t timeout)
Receive a packet using the RFM98 radio.
Definition rfm98.cpp:154
int32_t reset()
Resets the RFM98 radio.
Definition rfm98.cpp:99
int32_t init(rfm98_config cfg, Threads::Mutex *mtx)
Initialization of the RFM98 radio.
Definition rfm98.cpp:36
Definitions of Serial Console helper functions.
The pins used to connect the RFM98 to the Teensy.
Definition rfm98.h:61
uint8_t nirq
The interrupt pin.
Definition rfm98.h:69
uint8_t spi_mosi
The Master Out, Slave In (MOSI) pin.
Definition rfm98.h:65
uint8_t spi_sck
The SPI clock pin.
Definition rfm98.h:67
uint8_t spi_miso
The Master In, Slave Out (MISO) pin.
Definition rfm98.h:63
uint8_t reset
The reset pin.
Definition rfm98.h:73
uint8_t cs
The chip select pin.
Definition rfm98.h:71
The RFM98 configuration structure.
Definition rfm98.h:32
uint16_t freq
The operating frequency of the radio in MHz.
Definition rfm98.h:38
uint8_t tx_power
The transmitter power level in dBm.
Definition rfm98.h:47