ADI iSensor FX3 Firmware  v2.9.4-pub
Firmware for the Analog Devices EVAL-ADIS-FX3 IMU Evaluation Platform. This firmware can be compiled using the Cypress EZ USB Suite IDE
PinFunctions.h
Go to the documentation of this file.
1 
19 #ifndef PIN_FUNCTIONS_H
20 #define PIN_FUNCTIONS_H
21 
22 /* Include the main header file */
23 #include "main.h"
24 
26 typedef enum PinResistorSetting
27 {
29  None = 0,
30 
32  PullDown = 1,
33 
35  PullUp = 2
36 
38 
40 typedef enum PinState
41 {
43  Low = 0,
44 
46  High = 1,
47 
49  HighZ = 2
51 
52 /* Function definitions */
53 CyU3PReturnStatus_t AdiPulseDrive();
54 CyU3PReturnStatus_t AdiPulseWait(uint16_t transferLength);
55 CyU3PReturnStatus_t AdiSetPin(uint16_t pinNumber, CyBool_t polarity);
56 CyU3PReturnStatus_t AdiMeasurePinFreq();
57 CyU3PReturnStatus_t AdiWaitForPin(uint32_t pinNumber, CyU3PGpioIntrMode_t interruptSetting, uint32_t timeoutTicks);
58 CyU3PReturnStatus_t AdiPinRead(uint16_t pin);
59 CyU3PReturnStatus_t AdiReadTimerValue();
60 CyU3PReturnStatus_t AdiConfigurePWM(CyBool_t EnablePWM);
61 CyU3PReturnStatus_t AdiMeasureBusyPulse(uint16_t transferLength);
62 CyU3PReturnStatus_t AdiConfigurePinInterrupt(uint16_t pin, CyBool_t polarity);
63 CyU3PReturnStatus_t AdiMeasurePinDelay(uint16_t transferLength);
64 CyU3PReturnStatus_t AdiSetPinResistor(uint16_t pin, PinResistorSetting setting);
65 uint32_t AdiMStoTicks(uint32_t desiredStallTime);
66 uint32_t AdiReadTimerRegValue();
67 CyBool_t AdiIsValidGPIO(uint16_t GpioId);
68 PinState AdiGetPinState(uint16_t pin);
69 void AdiGetBoardPinInfo(uint8_t * outBuf);
70 
71 /*
72  * GPIO Pin mapping definitions
73  */
74 
76 #define ADI_3_3V_EN (33)
77 
79 #define ADI_5V_EN (34)
80 
82 #define ADI_ID_PIN_0 (17)
83 
85 #define ADI_ID_PIN_1 (15)
86 
88 #define ADI_FLASH_WRITE_ENABLE_PIN (35)
89 
91 #define ADI_DEBUG_TX_PIN (48)
92 
94 #define ADI_I2C_SCL_PIN (58)
95 
97 #define ADI_I2C_SDA_PIN (59)
98 
100 #define ADI_USER_LED_PIN (13)
101 
103 #define ADI_TIMER_PIN (24)
104 
105 /*
106  * ADI GPIO Event Handler Definitions
107  */
108 
110 #define ADI_DIO1_INTERRUPT_FLAG (1 << 0)
111 
113 #define ADI_DIO2_INTERRUPT_FLAG (1 << 1)
114 
116 #define ADI_DIO3_INTERRUPT_FLAG (1 << 2)
117 
119 #define ADI_DIO4_INTERRUPT_FLAG (1 << 3)
120 
122 #define FX3_GPIO1_INTERRUPT_FLAG (1 << 4)
123 
125 #define FX3_GPIO2_INTERRUPT_FLAG (1 << 5)
126 
128 #define FX3_GPIO3_INTERRUPT_FLAG (1 << 6)
129 
131 #define FX3_GPIO4_INTERRUPT_FLAG (1 << 7)
132 
133 #endif
AdiPulseDrive
CyU3PReturnStatus_t AdiPulseDrive()
This function drives a GPIO pin for a specified number of milliseconds, then returns it to the starti...
Definition: PinFunctions.c:781
PinState
PinState
Definition: PinFunctions.h:41
AdiWaitForPin
CyU3PReturnStatus_t AdiWaitForPin(uint32_t pinNumber, CyU3PGpioIntrMode_t interruptSetting, uint32_t timeoutTicks)
This function blocks the execution of the current thread until an event happens on the specified GPIO...
Definition: PinFunctions.c:1093
AdiReturnBulkEndpointData
void AdiReturnBulkEndpointData(CyU3PReturnStatus_t status, uint16_t length)
Sends a function result to the PC via the ChannelToPC endpoint.
Definition: HelperFunctions.c:49
AdiPinRead
CyU3PReturnStatus_t AdiPinRead(uint16_t pin)
This function handles Pin read control end point requests.
Definition: PinFunctions.c:1147
FX3PinMap::ADI_PIN_DIO1
uint16_t ADI_PIN_DIO1
Definition: main.h:122
FX3PinMap::ADI_PIN_DIO3
uint16_t ADI_PIN_DIO3
Definition: main.h:128
PinResistorSetting
PinResistorSetting
Definition: PinFunctions.h:27
GCTL_WPD_CFG
#define GCTL_WPD_CFG
Definition: main.h:404
BoardState::TimerPinConfig
uint32_t TimerPinConfig
Definition: main.h:162
FX3PinMap::FX3_PIN_GPIO1
uint16_t FX3_PIN_GPIO1
Definition: main.h:134
GCTL_WPU_CFG_UPPR
#define GCTL_WPU_CFG_UPPR
Definition: main.h:413
FX3PinMap::FX3_PIN_GPIO3
uint16_t FX3_PIN_GPIO3
Definition: main.h:140
AdiGetBoardPinInfo
void AdiGetBoardPinInfo(uint8_t *outBuf)
Gets the programmed board type and pin mapping info.
Definition: PinFunctions.c:37
AdiMeasurePinDelay
CyU3PReturnStatus_t AdiMeasurePinDelay(uint16_t transferLength)
Measures the delay from a trigger pin edge (sync) to a busy pin edge.
Definition: PinFunctions.c:271
AdiPulseDrive
CyU3PReturnStatus_t AdiPulseDrive()
This function drives a GPIO pin for a specified number of milliseconds, then returns it to the starti...
Definition: PinFunctions.c:781
ADI_ID_PIN_1
#define ADI_ID_PIN_1
Definition: PinFunctions.h:85
AdiPulseWait
CyU3PReturnStatus_t AdiPulseWait(uint16_t transferLength)
This function waits for a pin to reach a selected logic level. The PulseWait parameters are passed in...
Definition: PinFunctions.c:899
AdiPinRead
CyU3PReturnStatus_t AdiPinRead(uint16_t pin)
This function handles Pin read control end point requests.
Definition: PinFunctions.c:1147
Low
@ Low
Definition: PinFunctions.h:43
FX3PinMap::FX3_PIN_GPIO4
uint16_t FX3_PIN_GPIO4
Definition: main.h:143
BoardState::BoardType
FX3BoardType BoardType
Definition: main.h:189
High
@ High
Definition: PinFunctions.h:46
AdiIsValidGPIO
CyBool_t AdiIsValidGPIO(uint16_t GpioId)
Determines if a GPIO pin is valid for the FX3 Application firmware to set.
Definition: PinFunctions.c:222
AdiConfigurePinInterrupt
CyU3PReturnStatus_t AdiConfigurePinInterrupt(uint16_t pin, CyBool_t polarity)
configures the selected pin as an interrupt with edge triggering based on polarity
Definition: PinFunctions.c:1430
AdiSetPinResistor
CyU3PReturnStatus_t AdiSetPinResistor(uint16_t pin, PinResistorSetting setting)
Configure GPIO input stage pull up / pull down resistor.
Definition: PinFunctions.c:151
AdiMStoTicks
uint32_t AdiMStoTicks(uint32_t desiredStallTime)
Converts milliseconds to number of ticks and adjusts the resulting offset if below the measurable min...
Definition: PinFunctions.c:1132
AdiReadTimerValue
CyU3PReturnStatus_t AdiReadTimerValue()
Reads the current value from the complex GPIO timer and then sends the value over the control endpoin...
Definition: PinFunctions.c:1223
ADI_FLASH_WRITE_ENABLE_PIN
#define ADI_FLASH_WRITE_ENABLE_PIN
Definition: PinFunctions.h:88
GCTL_WPU_CFG
#define GCTL_WPU_CFG
Definition: main.h:410
ADI_TIMER_PIN
#define ADI_TIMER_PIN
Definition: PinFunctions.h:103
AdiReadTimerRegValue
uint32_t AdiReadTimerRegValue()
Reads the current value of the 10MHz timer (32 bit)
Definition: PinFunctions.c:1205
ADI_5V_EN
#define ADI_5V_EN
Definition: PinFunctions.h:79
FX3PinMap::ADI_PIN_DIO2
uint16_t ADI_PIN_DIO2
Definition: main.h:125
PullDown
@ PullDown
Definition: PinFunctions.h:32
PullUp
@ PullUp
Definition: PinFunctions.h:35
AdiGetPinState
PinState AdiGetPinState(uint16_t pin)
Determine state of an input pin (high, low, high Z)
Definition: PinFunctions.c:77
AdiMeasurePinFreq
CyU3PReturnStatus_t AdiMeasurePinFreq()
Measure the data ready frequency for a user specified pin.
Definition: PinFunctions.c:1255
AdiGetBoardPinInfo
void AdiGetBoardPinInfo(uint8_t *outBuf)
Gets the programmed board type and pin mapping info.
Definition: PinFunctions.c:37
AdiMStoTicks
uint32_t AdiMStoTicks(uint32_t timeInMS)
Converts milliseconds to number of ticks and adjusts the resulting offset if below the measurable min...
Definition: PinFunctions.c:1132
BoardState
Struct to store the current board state (SPI config, USB speed, etc)
Definition: main.h:148
None
@ None
Definition: PinFunctions.h:29
ADI_3_3V_EN
#define ADI_3_3V_EN
Definition: PinFunctions.h:76
GCTL_WPD_CFG_UPPR
#define GCTL_WPD_CFG_UPPR
Definition: main.h:407
AdiMeasureBusyPulse
CyU3PReturnStatus_t AdiMeasureBusyPulse(uint16_t transferLength)
Sets a user configurable trigger condition and then measures the following GPIO pulse.
Definition: PinFunctions.c:434
MS_TO_TICKS_MULT
#define MS_TO_TICKS_MULT
Definition: main.h:372
BoardState::PinMap
FX3PinMap PinMap
Definition: main.h:192
AdiSleepForMicroSeconds
CyU3PReturnStatus_t AdiSleepForMicroSeconds(uint32_t numMicroSeconds)
This function blocks thread execution for a specified number of microseconds.
Definition: HelperFunctions.c:73
FX3PinMap::ADI_PIN_RESET
uint16_t ADI_PIN_RESET
Definition: main.h:119
AdiSetPin
CyU3PReturnStatus_t AdiSetPin(uint16_t pinNumber, CyBool_t polarity)
This function configures the specified pin as an output and drives it with the desired value.
Definition: PinFunctions.c:1043
FX3PinMap::ADI_PIN_DIO4
uint16_t ADI_PIN_DIO4
Definition: main.h:131
BoardState::DrPin
uint16_t DrPin
Definition: main.h:168
AdiWaitForPin
CyU3PReturnStatus_t AdiWaitForPin(uint32_t pinNumber, CyU3PGpioIntrMode_t interruptSetting, uint32_t timeoutTicks)
This function blocks the execution of the current thread until an event happens on the specified GPIO...
Definition: PinFunctions.c:1093
AdiGetPinState
PinState AdiGetPinState(uint16_t pin)
Determine state of an input pin (high, low, high Z)
Definition: PinFunctions.c:77
AdiMeasurePinFreq
CyU3PReturnStatus_t AdiMeasurePinFreq()
Measure the data ready frequency for a user specified pin.
Definition: PinFunctions.c:1255
AdiConfigurePWM
CyU3PReturnStatus_t AdiConfigurePWM(CyBool_t EnablePWM)
This function configures the FX3 PWM outputs (enable or disable).
Definition: PinFunctions.c:669
FX3State
BoardState FX3State
Definition: main.c:112
PinFunctions.h
Header file for all the pin I/O and timing related functions.
main.h
Main header file for the Analog Devices iSensor FX3 Demonstration Platform firmware.
GpioHandler
CyU3PEvent GpioHandler
Definition: main.c:63
AdiIsValidGPIO
CyBool_t AdiIsValidGPIO(uint16_t GpioId)
Determines if a GPIO pin is valid for the FX3 Application firmware to set.
Definition: PinFunctions.c:222
PinFunctions_c
@ PinFunctions_c
Definition: ErrorLog.h:51
AdiReadTimerValue
CyU3PReturnStatus_t AdiReadTimerValue()
Reads the current value from the complex GPIO timer and then sends the value over the control endpoin...
Definition: PinFunctions.c:1223
ADI_TIMER_PIN_INDEX
#define ADI_TIMER_PIN_INDEX
Definition: main.h:381
AdiReadTimerRegValue
uint32_t AdiReadTimerRegValue()
Reads the current value of the 10MHz timer (32 bit)
Definition: PinFunctions.c:1205
ADI_I2C_SCL_PIN
#define ADI_I2C_SCL_PIN
Definition: PinFunctions.h:94
AdiMeasurePinDelay
CyU3PReturnStatus_t AdiMeasurePinDelay(uint16_t transferLength)
Measures the delay from a trigger pin edge (sync) to a busy pin edge.
Definition: PinFunctions.c:271
ADI_I2C_SDA_PIN
#define ADI_I2C_SDA_PIN
Definition: PinFunctions.h:97
AdiSetPin
CyU3PReturnStatus_t AdiSetPin(uint16_t pinNumber, CyBool_t polarity)
This function configures the specified pin as an output and drives it with the desired value.
Definition: PinFunctions.c:1043
AdiPulseWait
CyU3PReturnStatus_t AdiPulseWait(uint16_t transferLength)
This function waits for a pin to reach a selected logic level. The PulseWait parameters are passed in...
Definition: PinFunctions.c:899
HighZ
@ HighZ
Definition: PinFunctions.h:49
FX3PinMap::FX3_PIN_GPIO2
uint16_t FX3_PIN_GPIO2
Definition: main.h:137
AdiConfigurePWM
CyU3PReturnStatus_t AdiConfigurePWM(CyBool_t EnablePWM)
This function configures the FX3 PWM outputs (enable or disable).
Definition: PinFunctions.c:669
USBBuffer
uint8_t USBBuffer[4096]
AdiLogError
void AdiLogError(FileIdentifier File, uint32_t Line, uint32_t ErrorCode)
Logs a firmware error to flash memory for later examination.
Definition: ErrorLog.c:51
AdiMeasureBusyPulse
CyU3PReturnStatus_t AdiMeasureBusyPulse(uint16_t transferLength)
Sets a user configurable trigger condition and then measures the following GPIO pulse.
Definition: PinFunctions.c:434
AdiConfigurePinInterrupt
CyU3PReturnStatus_t AdiConfigurePinInterrupt(uint16_t pin, CyBool_t polarity)
configures the selected pin as an interrupt with edge triggering based on polarity
Definition: PinFunctions.c:1430
AdiSetPinResistor
CyU3PReturnStatus_t AdiSetPinResistor(uint16_t pin, PinResistorSetting setting)
Configure GPIO input stage pull up / pull down resistor.
Definition: PinFunctions.c:151
ADI_ID_PIN_0
#define ADI_ID_PIN_0
Definition: PinFunctions.h:82