lora sensnode

Dependencies:   libmDot mbed-rtos mbed

Fork of mDot_LoRa_Sensornode by Adrian Mitevski

Committer:
socie123
Date:
Wed Aug 10 12:54:10 2016 +0000
Revision:
1:e67174cc4953
Parent:
0:f2815503561f
lora sensnode

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 0:f2815503561f 1 /**
mitea1 0:f2815503561f 2 * @file SI1143Config.h
mitea1 0:f2815503561f 3 *
mitea1 0:f2815503561f 4 * @author Adrian
mitea1 0:f2815503561f 5 * @date 02.06.2016
mitea1 0:f2815503561f 6 *
mitea1 0:f2815503561f 7 */
mitea1 0:f2815503561f 8 #include <stdint.h>
mitea1 0:f2815503561f 9
mitea1 0:f2815503561f 10 #ifndef APP_SI1143CONFIG_H_
mitea1 0:f2815503561f 11 #define APP_SI1143CONFIG_H_
mitea1 0:f2815503561f 12
mitea1 0:f2815503561f 13 #define SI1143_LED_VOLTAGE_50_MV 0b0001
mitea1 0:f2815503561f 14 #define SI1143_LED_VOLTAGE_115_MV 0b0101
mitea1 0:f2815503561f 15 #define SI1143_LED_VOLTAGE_185_MV 0b0111
mitea1 0:f2815503561f 16 #define SI1143_LED_VOLTAGE_290_MV 0b1010
mitea1 0:f2815503561f 17 #define SI1143_LED_VOLTAGE_410_MV 0b1111
mitea1 0:f2815503561f 18
mitea1 0:f2815503561f 19 #define SI1143_PS1_IRQ_EN_MASK 0x02
mitea1 0:f2815503561f 20 #define SI1143_THRESHOLD_1000 0x3E8
mitea1 0:f2815503561f 21
mitea1 0:f2815503561f 22 /**
mitea1 0:f2815503561f 23 * SI1143 Modes. Modes define sensor functionality
mitea1 0:f2815503561f 24 */
mitea1 0:f2815503561f 25 enum SI1143_MODE{
mitea1 0:f2815503561f 26 SI1143_MODE_1,//!< SI1143_MODE_1
mitea1 0:f2815503561f 27 SI1143_MODE_2,//!< SI1143_MODE_2
mitea1 0:f2815503561f 28 SI1143_MODE_3,//!< SI1143_MODE_3
mitea1 0:f2815503561f 29 SI1143_MODE_4 //!< SI1143_MODE_4
mitea1 0:f2815503561f 30 };
mitea1 0:f2815503561f 31
mitea1 0:f2815503561f 32 /**
mitea1 0:f2815503561f 33 * @class SI1143Config
mitea1 0:f2815503561f 34 * @brief A configuration container for the SI1143 Sensor.
mitea1 0:f2815503561f 35 * All its configuration values are stored an held inside
mitea1 0:f2815503561f 36 * this Class. Depending on the SI1143_MODE it sets all the configuration values.
mitea1 0:f2815503561f 37 */
mitea1 0:f2815503561f 38 class SI1143Config {
mitea1 0:f2815503561f 39 public:
mitea1 0:f2815503561f 40 SI1143Config();
mitea1 0:f2815503561f 41 virtual ~SI1143Config();
mitea1 0:f2815503561f 42
mitea1 0:f2815503561f 43 /**
mitea1 0:f2815503561f 44 * @brief Generates a configuration and sets its value according to the
mitea1 0:f2815503561f 45 * chosen SI1143_MODE
mitea1 0:f2815503561f 46 * @param desiredMode the mode to build the configuration according to
mitea1 0:f2815503561f 47 */
mitea1 0:f2815503561f 48 void build(SI1143_MODE desiredMode);
mitea1 0:f2815503561f 49
mitea1 0:f2815503561f 50
mitea1 0:f2815503561f 51 /**
mitea1 0:f2815503561f 52 * @brief Gets the voltage of Led1 from the actual configuration
mitea1 0:f2815503561f 53 * @return led 1 voltage register value
mitea1 0:f2815503561f 54 */
mitea1 0:f2815503561f 55 uint8_t getLed1Voltage();
mitea1 0:f2815503561f 56
mitea1 0:f2815503561f 57 /**
mitea1 0:f2815503561f 58 * @brief Gets the interrupt enable from the actual configuration
mitea1 0:f2815503561f 59 * @return interrupt enable register value
mitea1 0:f2815503561f 60 */
mitea1 0:f2815503561f 61 uint8_t getInterruptEnable();
mitea1 0:f2815503561f 62
mitea1 0:f2815503561f 63 /**
mitea1 0:f2815503561f 64 * @brief Gets the proximity sensing threshold for led 1
mitea1 0:f2815503561f 65 * @return proximity sensing threshold for led 1 register value
mitea1 0:f2815503561f 66 */
mitea1 0:f2815503561f 67 uint8_t getProximitySensing1Threshold();
mitea1 0:f2815503561f 68
mitea1 0:f2815503561f 69 private:
mitea1 0:f2815503561f 70 uint8_t led1Voltage;
mitea1 0:f2815503561f 71 uint8_t interruptEnable;
mitea1 0:f2815503561f 72 uint16_t proximitySensing1Threshold;
mitea1 0:f2815503561f 73
mitea1 0:f2815503561f 74
mitea1 0:f2815503561f 75 /**
mitea1 0:f2815503561f 76 * @brief Sets the register value for the led 1 voltage of the actual configuration
mitea1 0:f2815503561f 77 * @param ledVoltag register value of the led1 voltage
mitea1 0:f2815503561f 78 */
mitea1 0:f2815503561f 79 void setLed1Voltage(uint8_t ledVoltage);
mitea1 0:f2815503561f 80
mitea1 0:f2815503561f 81 /**
mitea1 0:f2815503561f 82 * @brief Sets the interrupt enable register value of the actual configuration
mitea1 0:f2815503561f 83 * @param interruptEnable register value of interrupt enable
mitea1 0:f2815503561f 84 */
mitea1 0:f2815503561f 85 void setInterruptEnable(uint8_t interruptEnable);
mitea1 0:f2815503561f 86
mitea1 0:f2815503561f 87 /**
mitea1 0:f2815503561f 88 * @brief Sets the proximity sensing threshold register value of the actual configuration
mitea1 0:f2815503561f 89 * @param thershold register value of the proximity sensing threshold
mitea1 0:f2815503561f 90 */
mitea1 0:f2815503561f 91 void setProximitySensing1Threshold(uint16_t thershold);
mitea1 0:f2815503561f 92 };
mitea1 0:f2815503561f 93
mitea1 0:f2815503561f 94 #endif /* APP_SI1143CONFIG_H_ */