| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // 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)
- // i2c address for acting as target
- // (based on the GPIO 1 integer is added)
- #define I2C_TARGET_BASE_ADDRESS 0x48
- //------------
- // Section for configuring debugging outputs
- //------------
- // printf ADC outputs
- #define DEBUG_ADC 1
- // printf DAC outputs
- #define DEBUG_DAC 1
- // printf control loop outputs
- #define DEBUG_CTRL 1
- // printf trace: put also the transition messages
- #define DEBUG_TRACE_CTRL 1
- // printf i2c errors
- #define DEBUG_I2C_ERR 1
- // printf i2c traffic (tx)
- #define DEBUG_I2C_TX 1
- // printf target i2c interrupts (where the mcu is the i2c target)
- #define DEBUG_TARGET 1
- //------------
- // 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 master 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
|