Degree Computation

Dependencies:   aconno_SEGGER_RTT LSM9DS1 Si7006A20 adc52832_common aconnoMPL115A1 aconno_bsp

Committer:
jurica238814
Date:
Wed Dec 12 19:28:16 2018 +0100
Revision:
0:442d98af8cc7
Child:
4:cb3513aa9814
Init commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jurica238814 0:442d98af8cc7 1 /**
jurica238814 0:442d98af8cc7 2 * Made by Jurica @ aconno
jurica238814 0:442d98af8cc7 3 * jurica@aconno.com
jurica238814 0:442d98af8cc7 4 * More info @ aconno.de
jurica238814 0:442d98af8cc7 5 */
jurica238814 0:442d98af8cc7 6
jurica238814 0:442d98af8cc7 7 #ifndef __ACONNO_CONFIG_H__
jurica238814 0:442d98af8cc7 8 #define __ACONNO_CONFIG_H__
jurica238814 0:442d98af8cc7 9
jurica238814 0:442d98af8cc7 10 #define V0 (0.47) // In volts
jurica238814 0:442d98af8cc7 11 #define TC (0.01) // In volts
jurica238814 0:442d98af8cc7 12 #define VCC (3.6)
jurica238814 0:442d98af8cc7 13 #define VALUE_TO_PERCENTAGE (100)
jurica238814 0:442d98af8cc7 14 #define APPLICATION_ID (0xCF170059)
jurica238814 0:442d98af8cc7 15
jurica238814 0:442d98af8cc7 16 #define ADC_REFERENCE (3.6f) // adc reference voltage
jurica238814 0:442d98af8cc7 17 #define ADC_RESOLUTION (1024) // 10-bit adc
jurica238814 0:442d98af8cc7 18 #define CALIBRATION_STEPS (20)
jurica238814 0:442d98af8cc7 19 #define WAKEUP_TIME_DELAY_MS (150) // Time for sensors to wake up
jurica238814 0:442d98af8cc7 20
jurica238814 0:442d98af8cc7 21 #define I2C_DATA (p19)
jurica238814 0:442d98af8cc7 22 #define I2C_CLK (p20)
jurica238814 0:442d98af8cc7 23 #define SPI_MISO (p5)
jurica238814 0:442d98af8cc7 24 #define SPI_MOSI (p3)
jurica238814 0:442d98af8cc7 25 #define SPI_SCLK (p4)
jurica238814 0:442d98af8cc7 26
jurica238814 0:442d98af8cc7 27 #define SENSORS_REFRESH_RATE_MS (1000) // NOT IN USE!!
jurica238814 0:442d98af8cc7 28 // The beacon wakes up every ADV_PERIOD_TIME_MS
jurica238814 0:442d98af8cc7 29 #define USER_ADV_PERIOD_TIME_MS (1000-125)
jurica238814 0:442d98af8cc7 30 #define ADV_PERIOD_TIME_MS (USER_ADV_PERIOD_TIME_MS-WAKEUP_TIME_DELAY_MS)
jurica238814 0:442d98af8cc7 31 // The beacon advertises for RADIO_ACTIVE_TIME_MS
jurica238814 0:442d98af8cc7 32 #define BLE_PACKETS_TO_SEND (3)
jurica238814 0:442d98af8cc7 33 #define ADV_INTERVAL_MS (100) // Adv interval in ms (BLE level!)
jurica238814 0:442d98af8cc7 34 #define RADIO_ACTIVE_TIME_MS (ADV_INTERVAL_MS*BLE_PACKETS_TO_SEND)
jurica238814 0:442d98af8cc7 35 #define TX_POWER_DB (4)
jurica238814 0:442d98af8cc7 36
jurica238814 0:442d98af8cc7 37 struct __attribute__((packed, aligned(1))) advertising_packet
jurica238814 0:442d98af8cc7 38 {
jurica238814 0:442d98af8cc7 39 uint32_t header;
jurica238814 0:442d98af8cc7 40 uint8_t type;
jurica238814 0:442d98af8cc7 41 union{
jurica238814 0:442d98af8cc7 42 struct{
jurica238814 0:442d98af8cc7 43 int16_t gyroscope[3];
jurica238814 0:442d98af8cc7 44 int16_t accelerometer[3];
jurica238814 0:442d98af8cc7 45 int16_t magnetometer[3];
jurica238814 0:442d98af8cc7 46 uint16_t acc_lsb_value;
jurica238814 0:442d98af8cc7 47 };
jurica238814 0:442d98af8cc7 48 struct{
jurica238814 0:442d98af8cc7 49 float temperature;
jurica238814 0:442d98af8cc7 50 float humidity;
jurica238814 0:442d98af8cc7 51 float pressure;
jurica238814 0:442d98af8cc7 52 float light;
jurica238814 0:442d98af8cc7 53 uint8_t battery;
jurica238814 0:442d98af8cc7 54 };
jurica238814 0:442d98af8cc7 55 };
jurica238814 0:442d98af8cc7 56 };
jurica238814 0:442d98af8cc7 57
jurica238814 0:442d98af8cc7 58 #endif // __ACONNO_CONFIG_H__