Radio Structures in OOP

Dependencies:   mbed mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers robot.h Source File

robot.h

00001 #ifndef ROBOT_H // Only include once
00002 #define ROBOT_H
00003 
00004 // ** ============================= ** DEBUGGING OPTIONS ** ============================= **
00005 
00006 // Set the debugging level for compiling. Valid levels include `0`, `1`, `2`, `3`, & `4`.
00007 #define RJ_DEBUG_LEVEL  0
00008 
00009 /*
00010     This will enable/disable a `Log File` that is created at the mbed's startup. The file is written
00011     to the mbed's onboard flash memory and can be opened for debugging purposes if it is enabled.
00012     Note that you may have to disconnect and reconnect the mbed's USB connection for the file to show up
00013     if it is plugged into a computer during the startup process.
00014 */
00015 #define RJ_BOOT_LOG             1
00016 
00017 // This will check the mbed's firmware for the most known up-to-date version if enabled
00018 #define RJ_CHECK_FIRMWARE       1
00019 
00020 
00021 // ** ============================= ** ENABLE / DISABLE ROBOT INTERFACES ** ============================= **
00022 
00023 // Enable/Disable the `Primary Radio Interface` (915MHz band).
00024 #define RJ_PRIMARY_RADIO    1
00025 
00026 // Enable/Disable the `Secondary Radio Interface` (2.4GHz band).
00027 #define RJ_SECONDARY_RADIO  0
00028 
00029 // Enable/Disable the `Motion Processor Interface` (MPU-9250).
00030 #define RJ_MOTION_PROCESSOR 0
00031 
00032 // The `Watchdog Timer` timeout value. The mbed will reset if the timer is not reset after the number of seconds defined here
00033 #define RJ_WATCHDOG_TIMER_VALUE 2   // seconds
00034 
00035 
00036 // ** ============================= ** PIN DECLARATIONS ** ============================= **
00037 
00038 // This defines the pin used for the primary radio's `Chip Select` pin
00039 #define RJ_PRIMARY_RADIO_CS     p9
00040 
00041 // This defines the pin used for the primary radio's `Interrupt` pin
00042 #define RJ_PRIMARY_RADIO_INT    p8
00043 
00044 // This defines the pin used for the secondary radio's `Chip Enable` pin
00045 #define RJ_SECONDARY_RADIO_CE   p10
00046 
00047 // This defines the pin used for the secondary radio's `Chip Select` pin
00048 #define RJ_SECONDARY_RADIO_CS   p11
00049 
00050 // This defines the pin used for the secondary radio's `Interrupt` pin
00051 #define RJ_SECONDARY_RADIO_IRQ  p12
00052 
00053 // This defines the pin used for the primary radio's `GDO2` pin
00054 #define RJ_PRIMARY_RADIO_GDO2   p13
00055 
00056 // This defines the speaker's audio output pin
00057 #define RJ_SPEAKER_OUT          p18
00058 
00059 // This defines the ball sensor's detector pin
00060 #define RJ_BALL_DETECTOR        p19
00061 
00062 // This defines the ball sensor's emitter pin
00063 #define RJ_BALL_EMITTER         p20
00064 
00065 // This defines the pin used for the secondary radio's `Chip Select` pin
00066 // #define RJ_SECONDARY_RADIO_CS   p21
00067 
00068 // This defines the pin used for indicating mbed runtime activity
00069 #define RJ_STATUS_LED           LED1
00070 
00071 // These pin declarations are used for showing `TX` & `RX` radio connectivity
00072 #define RJ_TX_LED               LED2
00073 #define RJ_RX_LED               LED3
00074 
00075 // This defines the pin used for a miscellaneous LED
00076 #define RJ_MISC_LED             LED4
00077 
00078 // This defines the pins used for a `Serial Connection` over the mbed's USB port (for use with a virtual serial connection to a computer)
00079 #define RJ_SERIAL_RXTX          MBED_UARTUSB
00080 
00081 // This defines the mbed pins used for its `Serial Peripheral Interface`
00082 #define RJ_SPI_BUS              p5, p6, p7  // MOSI, MISO, SCK
00083 
00084 // This defines the mbed pins used for its `I2C Interface`
00085 #define RJ_I2C_BUS              p28, p27    // SDA, SCL
00086 
00087 // This defines the mbed pin used for reading an analog voltage for the robot's battery
00088 #define RJ_BATT_IN              p14
00089 
00090 // This defines the mbed pin used for communicating to one of Adafruit's `Neopixel LEDs` for the primary power LED (RGB LEB)
00091 #define RJ_POWER_LED            p16
00092 
00093 // This defines the mbed pin used as an `Interrupt` for the MPU-9250
00094 #define RJ_MOTION_PROCESSOR_INT p17
00095 
00096 // This defines the mbed pin used as the 'Chip Select` pin for the MPU-9250
00097 #define RJ_MOTION_PROCESSOR_CS  p19
00098 
00099 // This defines the mbed pin used as the `Chip Select` pin for the Spartan-3E FPGA
00100 #define RJ_FPGA_CS              p24
00101 
00102 // These two (2) pins are used for configuring the FPGA upon startup
00103 #define RJ_FPGA_FS0             p23
00104 #define RJ_FPGA_FS1             p22
00105 
00106 // This defines the mbed pin used as the `Chip Select` pin for the 16 pin I/O expander
00107 #define RJ_IO_EXPANDER_CS       p29
00108 
00109 // This defines the mbed pin used as the `Chip Select` pin for reading the kicker's voltage from an external ADC using I2C communication
00110 #define RJ_ADC_CS               p26
00111 
00112 // This defines the mbed pin used as the `Program` pin for the FPGA's configuration
00113 #define RJ_FPGA_PROG            p25
00114 
00115 // These are the leftover pins. This will be used for the finalized design - designs changes are in progress
00116 #define RJ_UNUSED_1             p15
00117 #define RJ_UNUSED_2             p30
00118 
00119 
00120 // ** ============================= ** DO NOT EDIT ANYTHING BELOW HERE ** ============================= **
00121 // ** ================================================================================================= **
00122 
00123 // Include the basic classes - Note: the header files included within "mbed.h" are listed here.
00124 #include "mbed.h"
00125 /*
00126 #include <stdio.h>
00127 #include <stdlib.h>
00128 #include <string.h>
00129 #include <math.h>
00130 #include <time.h>
00131 
00132 #include "error.h"
00133 #include "mbed_interface.h"
00134 
00135 #include "DigitalIn.h"
00136 #include "DigitalOut.h"
00137 #include "DigitalInOut.h"
00138 #include "BusIn.h"
00139 #include "BusOut.h"
00140 #include "BusInOut.h"
00141 #include "PortIn.h"
00142 #include "PortInOut.h"
00143 #include "PortOut.h"
00144 #include "AnalogIn.h"
00145 #include "AnalogOut.h"
00146 #include "PwmOut.h"
00147 #include "Serial.h"
00148 #include "SerialHalfDuplex.h"
00149 #include "SPI.h"
00150 #include "SPISlave.h"
00151 #include "SPIHalfDuplex.h"
00152 #include "I2C.h"
00153 #include "I2CSlave.h"
00154 #include "Ethernet.h"
00155 #include "CAN.h"
00156 
00157 #include "Timer.h"
00158 #include "Ticker.h"
00159 #include "Timeout.h"
00160 #include "LocalFileSystem.h"
00161 #include "InterruptIn.h"
00162 #include "wait_api.h"
00163 #include "rtc_time.h"
00164 */
00165 
00166 // Include header file for the CMSIS Real Time Operating System
00167 #include "cmsis_os.h"
00168 
00169 #if RJ_CHECK_FIRMWARE
00170 #include "FirmwareCheck.h"
00171 #endif
00172 
00173 // Include the header file for the watchdog timer class
00174 #include "Watchdog.h"
00175 
00176 // Include the base classes for communication if a communication link is active
00177 #if RJ_PRIMARY_RADIO | RJ_SECONDARY_RADIO
00178 #include "CommModule.h"
00179 #include "CommLink.h"
00180 #endif
00181 
00182 // Include the primary radio class if 915MHz band radio [if active]
00183 #if RJ_PRIMARY_RADIO
00184 #include "CC1101.h"
00185 #endif
00186 
00187 // Include the secondary radio class if 2.4GHz band radio [if active]
00188 #if RJ_SECONDARY_RADIO
00189 #include "nRF24L01.h"
00190 #endif
00191 
00192 #include "Logger.h"
00193 
00194 #endif // ROBOT_H