Mouse code for the MacroRat
mbed-dev/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/efr32-rf-driver/rail/pti.h@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /***************************************************************************//** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * @file pti.h |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @brief This header file contains information for working with the packet |
sahilmgandhi | 18:6a4db94011d3 | 4 | * trace APIs. |
sahilmgandhi | 18:6a4db94011d3 | 5 | * @copyright Copyright 2015 Silicon Laboratories, Inc. http://www.silabs.com |
sahilmgandhi | 18:6a4db94011d3 | 6 | ******************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 7 | |
sahilmgandhi | 18:6a4db94011d3 | 8 | #ifndef __RADIO_PTI_H |
sahilmgandhi | 18:6a4db94011d3 | 9 | #define __RADIO_PTI_H |
sahilmgandhi | 18:6a4db94011d3 | 10 | |
sahilmgandhi | 18:6a4db94011d3 | 11 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 12 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 13 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 14 | |
sahilmgandhi | 18:6a4db94011d3 | 15 | #include <stdint.h> |
sahilmgandhi | 18:6a4db94011d3 | 16 | #include "em_gpio.h" |
sahilmgandhi | 18:6a4db94011d3 | 17 | |
sahilmgandhi | 18:6a4db94011d3 | 18 | /******************************** TYPEDEFS *********************************/ |
sahilmgandhi | 18:6a4db94011d3 | 19 | |
sahilmgandhi | 18:6a4db94011d3 | 20 | /** Channel type enumeration. */ |
sahilmgandhi | 18:6a4db94011d3 | 21 | typedef enum RADIO_PTIMode |
sahilmgandhi | 18:6a4db94011d3 | 22 | { |
sahilmgandhi | 18:6a4db94011d3 | 23 | /** SPI mode. */ |
sahilmgandhi | 18:6a4db94011d3 | 24 | RADIO_PTI_MODE_SPI = 0U, |
sahilmgandhi | 18:6a4db94011d3 | 25 | /** UART mode. */ |
sahilmgandhi | 18:6a4db94011d3 | 26 | RADIO_PTI_MODE_UART = 1U, |
sahilmgandhi | 18:6a4db94011d3 | 27 | /** 9bit UART mode. */ |
sahilmgandhi | 18:6a4db94011d3 | 28 | RADIO_PTI_MODE_UART_ONEWIRE = 2U, |
sahilmgandhi | 18:6a4db94011d3 | 29 | /** Turn PTI off entirely */ |
sahilmgandhi | 18:6a4db94011d3 | 30 | RADIO_PTI_MODE_DISABLED = 3U, |
sahilmgandhi | 18:6a4db94011d3 | 31 | } RADIO_PTIMode_t; |
sahilmgandhi | 18:6a4db94011d3 | 32 | |
sahilmgandhi | 18:6a4db94011d3 | 33 | /** |
sahilmgandhi | 18:6a4db94011d3 | 34 | * @struct RADIO_PTIInit_t |
sahilmgandhi | 18:6a4db94011d3 | 35 | * @brief Configuration structure for the packet trace interface (PTI) |
sahilmgandhi | 18:6a4db94011d3 | 36 | */ |
sahilmgandhi | 18:6a4db94011d3 | 37 | typedef struct RADIO_PTIInit { |
sahilmgandhi | 18:6a4db94011d3 | 38 | /** Packet Trace mode (UART or SPI) */ |
sahilmgandhi | 18:6a4db94011d3 | 39 | RADIO_PTIMode_t mode; |
sahilmgandhi | 18:6a4db94011d3 | 40 | |
sahilmgandhi | 18:6a4db94011d3 | 41 | /** Output baudrate for PTI in Hz */ |
sahilmgandhi | 18:6a4db94011d3 | 42 | uint32_t baud; |
sahilmgandhi | 18:6a4db94011d3 | 43 | |
sahilmgandhi | 18:6a4db94011d3 | 44 | /** Data output (DOUT) location for pin/port */ |
sahilmgandhi | 18:6a4db94011d3 | 45 | uint8_t doutLoc; |
sahilmgandhi | 18:6a4db94011d3 | 46 | /** Data output (DOUT) GPIO port */ |
sahilmgandhi | 18:6a4db94011d3 | 47 | GPIO_Port_TypeDef doutPort; |
sahilmgandhi | 18:6a4db94011d3 | 48 | /** Data output (DOUT) GPIO pin */ |
sahilmgandhi | 18:6a4db94011d3 | 49 | uint8_t doutPin; |
sahilmgandhi | 18:6a4db94011d3 | 50 | |
sahilmgandhi | 18:6a4db94011d3 | 51 | /** Data clock (DCLK) location for pin/port. Only used in SPI mode */ |
sahilmgandhi | 18:6a4db94011d3 | 52 | uint8_t dclkLoc; |
sahilmgandhi | 18:6a4db94011d3 | 53 | /** Data clock (DCLK) GPIO port. Only used in SPI mode */ |
sahilmgandhi | 18:6a4db94011d3 | 54 | GPIO_Port_TypeDef dclkPort; |
sahilmgandhi | 18:6a4db94011d3 | 55 | /** Data clock (DCLK) GPIO pin. Only used in SPI mode */ |
sahilmgandhi | 18:6a4db94011d3 | 56 | uint8_t dclkPin; |
sahilmgandhi | 18:6a4db94011d3 | 57 | |
sahilmgandhi | 18:6a4db94011d3 | 58 | /** Data frame (DFRAME) location for pin/port. Only used for */ |
sahilmgandhi | 18:6a4db94011d3 | 59 | uint8_t dframeLoc; |
sahilmgandhi | 18:6a4db94011d3 | 60 | /** Data frame (DFRAME) GPIO port */ |
sahilmgandhi | 18:6a4db94011d3 | 61 | GPIO_Port_TypeDef dframePort; |
sahilmgandhi | 18:6a4db94011d3 | 62 | /** Data frame (DFRAME) GPIO pin */ |
sahilmgandhi | 18:6a4db94011d3 | 63 | uint8_t dframePin; |
sahilmgandhi | 18:6a4db94011d3 | 64 | } RADIO_PTIInit_t; |
sahilmgandhi | 18:6a4db94011d3 | 65 | |
sahilmgandhi | 18:6a4db94011d3 | 66 | /************************* FUNCTION PROTOTYPES *****************************/ |
sahilmgandhi | 18:6a4db94011d3 | 67 | void RADIO_PTI_Init(RADIO_PTIInit_t *pitInit); |
sahilmgandhi | 18:6a4db94011d3 | 68 | void RADIO_PTI_Enable(void); |
sahilmgandhi | 18:6a4db94011d3 | 69 | void RADIO_PTI_Disable(void); |
sahilmgandhi | 18:6a4db94011d3 | 70 | |
sahilmgandhi | 18:6a4db94011d3 | 71 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 72 | } |
sahilmgandhi | 18:6a4db94011d3 | 73 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 74 | |
sahilmgandhi | 18:6a4db94011d3 | 75 | #endif //__RADIO_PTI_H |