...
- front_power_distribution_can_rx_event_mapper
- Receives can messages and raises events.
- front_power_distribution_gpio
- Receives GPIO events and sets the corresponding GPIO pin states.
- front_power_distribution_current_measurement
- methods:
- front_power_distribution_current_measurement_init()
- Periodically Reads current values from all the load switches in some period of time
- will use 4 instances of bts_7200_current_sense
- will have a timer, every time the timer goes off, it'll read from all 4 storages.
- raise a FRONT_POWER_DISTRIBUTION_CURRENT_SENSE_DATA_READY
- front_power_distribution_storage_global()
- simply returns the storage.
- front_power_distribution_current_measurement_init()
- methods:
- front_power_distribution_publish_data
- Periodically broadcasts the gathered data from front_power_distribution_current_measurement
- main
- initializes the modules, processes the event queue and passes it into the other modules.
Libraries
- bts_7200_current_sense
- methods:
- bts_7200_init(configuration)
- configuration
- Select Pin Address
- Sense Pin Address
- callback
- initialize select pin as GPIO Output
- initialize sense pin as GPIO Input, (adc)
- periodically set up timers
- every time timer goes off, we'll
- measure with sel 1
- measure with sel 2
- update storage with that measurement
- every time timer goes off, we'll
- configuration
- bts_7200_get_measurement()
- returns whatever measurement is in its storage
- bts_7200_init(configuration)
- methods:
- signal_lights_fsm
- Uses blinkers to repeatedly raise events
- Has a state machine implementing the.
- inputs:
- event names: signal_left_fsm_input, signal_right_fsm_input, hazard_fsm_input, sync
- outputs:
- signal_left_fsm_output
- signal_right_fsm_output
- signal_both_output, or you can raise a left_output and right_output...
- blink_event_generator
- uses soft_timers to repeatedly raise an event with a data field
- inputs:
- event_id
- outputs:
- raising that event_id with alternating data fields.
Events:
event | source | destination | data |
---|---|---|---|
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_DRIVER_DISPLAY | front_power_distribution_can_rx_event_mapper | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_STEERING | front_power_distribution_can_rx_event_mapper | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_CENTRE_CONSOLE | front_power_distribution_can_rx_event_mapper | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_HEADLIGHTS | front_power_distribution_can_rx_event_mapper | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_SIGNAL_LEFT | blink_event_generator | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_SIGNAL_RIGHT | blink_event_generator | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_SIGNAL_HAZARD | blink_event_generator | front_power_distribution_gpio | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_LEFT | front_power_distribution_can_rx_event_mapper | signal_lights_fsm | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_RIGHT | front_power_distribution_can_rx_event_mapper | signal_lights_fsm | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_HAZARD | front_power_distribution_can_rx_event_mapper | signal_lights_fsm | 1: on, 0: off |
FRONT_POWER_DISTRIBUTION_CURRENT_SENSE_DATA_READY | front_power_distribution_current_measurement | front_power_distribution_publish_data | empty |
Incoming CAN Messages:
Message ID | Data Fields | Exported Enums |
---|---|---|
SYSTEM_CAN_MESSAGE_FRONT_POWER | uint16_t output_bitset, uint16_t state_bitset | EEFrontPowerDistributionOutput, EEFrontPowerDistributionOutputState |
SYSTEM_CAN_MESSAGE_LIGHTS | uint16_t light_type_bitset, uint16_t state_bitset | EELightType, EELightState |
SYSTEM_CAN_MESSAGE_LIGHTS_SYNC | empty | |
SYSTEM_CAN_MESSAGE_HORN | uint8_t horn_state | EEHornState |
...