|
|
@@ -0,0 +1,53 @@
|
|
|
+// globals definition
|
|
|
+
|
|
|
+//------------------------
|
|
|
+// Configuration section
|
|
|
+
|
|
|
+// How many slots do we currently support?
|
|
|
+// use 1 for debugging, 4 for production
|
|
|
+#define NUM_SLOTS 1
|
|
|
+
|
|
|
+//Battery Tolerance
|
|
|
+// how much tolerance do we allow if we charge / discharge before we
|
|
|
+// trigger the control loop to adjust the value
|
|
|
+#define BATTERY_CURRENT_THRESHOLD 5
|
|
|
+
|
|
|
+// Mainloop sleep time
|
|
|
+// Time to sleep between two mainloop intervals
|
|
|
+// We have a 32 MHz clock
|
|
|
+// debugging e.g. 32000000*5 -> 5s
|
|
|
+// production e.g. 320000 (10ms) (Validate that this is really the case!)
|
|
|
+// should be large for debugging, (e.g. )
|
|
|
+// small for production
|
|
|
+#define MAINLOOP_DELAY (32000000*5)
|
|
|
+
|
|
|
+//------------
|
|
|
+// Section for configuring error tresholds
|
|
|
+//------------
|
|
|
+
|
|
|
+// soft overvoltage treshold before getting into the soft overvoltage state
|
|
|
+#define SOV_THRESHOLD_MV 6000
|
|
|
+
|
|
|
+// hard overvoltage treshold for getting into the hard overvoltage state (error)
|
|
|
+#define HOV_THRESHOLD_MV 8000
|
|
|
+
|
|
|
+// define the temperature error state
|
|
|
+#define OVERTEMPERATURE_TRESHOLD 43
|
|
|
+
|
|
|
+//------------
|
|
|
+// Section for configuring i2c values
|
|
|
+//------------
|
|
|
+// dac address
|
|
|
+#define DAC_TARGET_ADDRESS 0x60
|
|
|
+
|
|
|
+// ADC base address
|
|
|
+// it is assumed the slots are ADC ADC_TARGET_BASE_ADDRESS slot 0,
|
|
|
+// ADC_TARGET_BASE_ADDRESS+1 slot 1, etc.
|
|
|
+#define ADC_TARGET_BASE_ADDRESS 0x68
|
|
|
+
|
|
|
+
|
|
|
+// Packet buffer sizes for RX and TX for the
|
|
|
+// controller mode only
|
|
|
+// (target for the other MCU is treated differently)
|
|
|
+#define I2C_TX_MAX_PACKET_SIZE 5
|
|
|
+#define I2C_RX_MAX_PACKET_SIZE 5
|