A multifunctional and modular Firmware for Multitech's mDot based on ARM mBed provides a widerange of functionality for several Sensors such as MAX44009, BME280, MPU9250, SI1143 and uBlox. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

Dependencies:   mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SI1143Config.h Source File

SI1143Config.h

Go to the documentation of this file.
00001 /**
00002  * @file SI1143Config.h
00003  *
00004  * @author Adrian
00005  * @date 02.06.2016
00006  *
00007  */
00008 #include <stdint.h>
00009 
00010 #ifndef APP_SI1143CONFIG_H_
00011 #define APP_SI1143CONFIG_H_
00012 
00013 #define SI1143_LED_VOLTAGE_50_MV    0b0001
00014 #define SI1143_LED_VOLTAGE_115_MV   0b0101
00015 #define SI1143_LED_VOLTAGE_185_MV   0b0111
00016 #define SI1143_LED_VOLTAGE_290_MV   0b1010
00017 #define SI1143_LED_VOLTAGE_410_MV   0b1111
00018 
00019 #define SI1143_PS1_IRQ_EN_MASK      0x02
00020 #define SI1143_THRESHOLD_1000       0x3E8
00021 
00022 /**
00023  * SI1143 Modes. Modes define sensor functionality
00024  */
00025 enum SI1143_MODE{
00026     SI1143_MODE_1,//!< SI1143_MODE_1
00027     SI1143_MODE_2,//!< SI1143_MODE_2
00028     SI1143_MODE_3,//!< SI1143_MODE_3
00029     SI1143_MODE_4 //!< SI1143_MODE_4
00030 };
00031 
00032 /**
00033  * @class SI1143Config
00034  * @brief A configuration container for the SI1143 Sensor.
00035  * All its configuration values are stored an held inside
00036  * this Class. Depending on the SI1143_MODE it sets all the configuration values.
00037  */
00038 class SI1143Config {
00039 public:
00040     SI1143Config();
00041     virtual ~SI1143Config();
00042 
00043     /**
00044      * @brief Generates a configuration and sets its value according to the
00045      * chosen SI1143_MODE
00046      * @param desiredMode the mode to build the configuration according to
00047      */
00048     void build(SI1143_MODE desiredMode);
00049 
00050 
00051     /**
00052      * @brief Gets the voltage of Led1 from the actual configuration
00053      * @return led 1 voltage register value
00054      */
00055     uint8_t getLed1Voltage();
00056 
00057     /**
00058      * @brief Gets the interrupt enable from the actual configuration
00059      * @return interrupt enable register value
00060      */
00061     uint8_t getInterruptEnable();
00062 
00063     /**
00064      * @brief Gets the proximity sensing threshold for led 1
00065      * @return proximity sensing threshold for led 1 register value
00066      */
00067     uint8_t getProximitySensing1Threshold();
00068 
00069 private:
00070     uint8_t led1Voltage;
00071     uint8_t interruptEnable;
00072     uint16_t proximitySensing1Threshold;
00073 
00074 
00075     /**
00076      * @brief Sets the register value for the led 1 voltage of the actual configuration
00077      * @param ledVoltag register value of the led1 voltage
00078      */
00079     void setLed1Voltage(uint8_t ledVoltage);
00080 
00081     /**
00082      * @brief Sets the interrupt enable register value of the actual configuration
00083      * @param interruptEnable register value of interrupt enable
00084      */
00085     void setInterruptEnable(uint8_t interruptEnable);
00086 
00087     /**
00088      * @brief Sets the proximity sensing threshold register value of the actual configuration
00089      * @param thershold register value of the proximity sensing threshold
00090      */
00091     void setProximitySensing1Threshold(uint16_t thershold);
00092 };
00093 
00094 #endif /* APP_SI1143CONFIG_H_ */