![](/media/cache/group/Semtech_stack_color_logo_highres.jpg.50x50_q85.jpg)
This code holds the complete demo set for the sx1280: PingPong, PER and Ranging Outdoor demo application. >>>>> This code MUST run on the mbed library release 127 or everything will be painfully slow.
Dependencies: mbed SX1280Lib DmTftLibrary
* This code MUST run on the mbed library release 127 or everything will be painfully slow.*
Peripherals/SX9306.h@20:626b92b70bf7, 2018-11-08 (annotated)
- Committer:
- mverdy
- Date:
- Thu Nov 08 10:14:39 2018 +0000
- Revision:
- 20:626b92b70bf7
Addition of missing modules to synchronize with v1.5.2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mverdy | 20:626b92b70bf7 | 1 | /* |
mverdy | 20:626b92b70bf7 | 2 | ______ _ |
mverdy | 20:626b92b70bf7 | 3 | / _____) _ | | |
mverdy | 20:626b92b70bf7 | 4 | ( (____ _____ ____ _| |_ _____ ____| |__ |
mverdy | 20:626b92b70bf7 | 5 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
mverdy | 20:626b92b70bf7 | 6 | _____) ) ____| | | || |_| ____( (___| | | | |
mverdy | 20:626b92b70bf7 | 7 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
mverdy | 20:626b92b70bf7 | 8 | (C)2016 Semtech |
mverdy | 20:626b92b70bf7 | 9 | |
mverdy | 20:626b92b70bf7 | 10 | Description: SX9306 Proximity header |
mverdy | 20:626b92b70bf7 | 11 | |
mverdy | 20:626b92b70bf7 | 12 | Maintainer: Gregory Cristian & Gilbert Menth |
mverdy | 20:626b92b70bf7 | 13 | */ |
mverdy | 20:626b92b70bf7 | 14 | |
mverdy | 20:626b92b70bf7 | 15 | #ifndef PROXIMITY_H |
mverdy | 20:626b92b70bf7 | 16 | #define PROXIMITY_H |
mverdy | 20:626b92b70bf7 | 17 | |
mverdy | 20:626b92b70bf7 | 18 | |
mverdy | 20:626b92b70bf7 | 19 | #define ANTENNA_1 0 |
mverdy | 20:626b92b70bf7 | 20 | #define ANTENNA_2 1 |
mverdy | 20:626b92b70bf7 | 21 | |
mverdy | 20:626b92b70bf7 | 22 | |
mverdy | 20:626b92b70bf7 | 23 | #define REG_IRQ_SRC ( 0x00 ) // Interrupt sources |
mverdy | 20:626b92b70bf7 | 24 | #define REG_STATUS ( 0x01 ) // Status |
mverdy | 20:626b92b70bf7 | 25 | #define REG_IRQ_MASK ( 0x03 ) // Irq mask |
mverdy | 20:626b92b70bf7 | 26 | #define REG_SENSORSEL ( 0x20 ) // Select which sensor |
mverdy | 20:626b92b70bf7 | 27 | #define REG_PROXUSEFUL ( 0x21 ) // Instantaneous sensor value |
mverdy | 20:626b92b70bf7 | 28 | #define REG_PROXAVG ( 0x23 ) // Averaged sensor value |
mverdy | 20:626b92b70bf7 | 29 | #define REG_CONTROL_0 ( 0x06 ) // Enable and scan period |
mverdy | 20:626b92b70bf7 | 30 | #define REG_CONTROL_1 ( 0x07 ) // |
mverdy | 20:626b92b70bf7 | 31 | #define REG_CONTROL_2 ( 0x08 ) // |
mverdy | 20:626b92b70bf7 | 32 | #define REG_CONTROL_3 ( 0x09 ) // Doze and filter |
mverdy | 20:626b92b70bf7 | 33 | #define REG_CONTROL_4 ( 0x0A ) // |
mverdy | 20:626b92b70bf7 | 34 | #define REG_CONTROL_5 ( 0x0B ) // |
mverdy | 20:626b92b70bf7 | 35 | #define REG_CONTROL_6 ( 0x0C ) // |
mverdy | 20:626b92b70bf7 | 36 | #define REG_CONTROL_7 ( 0x0D ) // |
mverdy | 20:626b92b70bf7 | 37 | #define REG_CONTROL_8 ( 0x0E ) // |
mverdy | 20:626b92b70bf7 | 38 | |
mverdy | 20:626b92b70bf7 | 39 | #define SAR_RATIO_THRESH ( 0x10 ) //Just for test |
mverdy | 20:626b92b70bf7 | 40 | |
mverdy | 20:626b92b70bf7 | 41 | #define SENSOR_SEL_1 ( 0x02 ) // Select antenna 1 |
mverdy | 20:626b92b70bf7 | 42 | #define SENSOR_SEL_2 ( 0x03 ) // Select antenna 2 |
mverdy | 20:626b92b70bf7 | 43 | #define SENSOR_ENABLE_23 ( 0x0C ) // Enabled sensors 2 & 3 (anteenas 1 & 2) |
mverdy | 20:626b92b70bf7 | 44 | #define SENSOR_DOZE_OFF ( 0x00 ) // Prevents doze mode starting |
mverdy | 20:626b92b70bf7 | 45 | #define PROXIMITY_I2C_ADDR ( 0x54 ) // Proximity IC I2C address |
mverdy | 20:626b92b70bf7 | 46 | #define MAX_GAIN ( 0x77 ) // Maximum gain and best granularity |
mverdy | 20:626b92b70bf7 | 47 | |
mverdy | 20:626b92b70bf7 | 48 | struct ProximityStruct |
mverdy | 20:626b92b70bf7 | 49 | { |
mverdy | 20:626b92b70bf7 | 50 | int16_t Instantaneous; |
mverdy | 20:626b92b70bf7 | 51 | int16_t Averaged; |
mverdy | 20:626b92b70bf7 | 52 | }; |
mverdy | 20:626b92b70bf7 | 53 | |
mverdy | 20:626b92b70bf7 | 54 | |
mverdy | 20:626b92b70bf7 | 55 | /*! |
mverdy | 20:626b92b70bf7 | 56 | * \brief Initialses the hardware and variables associated with the SX9306. |
mverdy | 20:626b92b70bf7 | 57 | */ |
mverdy | 20:626b92b70bf7 | 58 | void SX9306ProximityInit( void ); |
mverdy | 20:626b92b70bf7 | 59 | |
mverdy | 20:626b92b70bf7 | 60 | /*! |
mverdy | 20:626b92b70bf7 | 61 | * \brief Called from the main loop in order to deal with SX9306 communications. |
mverdy | 20:626b92b70bf7 | 62 | */ |
mverdy | 20:626b92b70bf7 | 63 | void SX9306ProximityHandle( void ); |
mverdy | 20:626b92b70bf7 | 64 | |
mverdy | 20:626b92b70bf7 | 65 | /*! |
mverdy | 20:626b92b70bf7 | 66 | * \brief Generic command used to read and write from the various SX9306 |
mverdy | 20:626b92b70bf7 | 67 | * registers. Called from the USB serial port |
mverdy | 20:626b92b70bf7 | 68 | * |
mverdy | 20:626b92b70bf7 | 69 | * \param [in] WriteNotRead If true defines a write operation |
mverdy | 20:626b92b70bf7 | 70 | * \param [in] Address Addess of the register inside the SX9306 to access |
mverdy | 20:626b92b70bf7 | 71 | * \param [in] WriteValue Value to be written to the defined register, if a |
mverdy | 20:626b92b70bf7 | 72 | * write is specified |
mverdy | 20:626b92b70bf7 | 73 | * \param [in] *ReadValue Pointer to the where a read operation should place |
mverdy | 20:626b92b70bf7 | 74 | * the data |
mverdy | 20:626b92b70bf7 | 75 | * |
mverdy | 20:626b92b70bf7 | 76 | * \retval Status Non zero = sucess. |
mverdy | 20:626b92b70bf7 | 77 | */ |
mverdy | 20:626b92b70bf7 | 78 | uint8_t SX9306proximitySerialCommand( uint8_t writeNotRead, uint8_t address, \ |
mverdy | 20:626b92b70bf7 | 79 | uint8_t writeValue, uint8_t *readValue ); |
mverdy | 20:626b92b70bf7 | 80 | |
mverdy | 20:626b92b70bf7 | 81 | /*! |
mverdy | 20:626b92b70bf7 | 82 | * \brief Generic command used to read and write from the various SX9306 |
mverdy | 20:626b92b70bf7 | 83 | * registers. Called from the USB serial port |
mverdy | 20:626b92b70bf7 | 84 | * |
mverdy | 20:626b92b70bf7 | 85 | * \param [in] ThisAntenna Defines which antenna is to be read (0 or 1) |
mverdy | 20:626b92b70bf7 | 86 | * |
mverdy | 20:626b92b70bf7 | 87 | * \retval Value The value read from the defined antenna. |
mverdy | 20:626b92b70bf7 | 88 | */ |
mverdy | 20:626b92b70bf7 | 89 | uint16_t SX9306proximityGetReadValue( uint32_t thisAntenna ); |
mverdy | 20:626b92b70bf7 | 90 | |
mverdy | 20:626b92b70bf7 | 91 | #endif //PROXIMITY_H |
mverdy | 20:626b92b70bf7 | 92 |