Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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_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

  • signal_lightsbts_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
      • bts_7200_get_measurement()
        • returns whatever measurement is in its storage
  • lights_signal_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...
  • blinkerblink_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: 

eventsourcedestinationdata
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_DRIVER_DISPLAYfront_power_distribution_can_rx_event_mapperfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_STEERINGfront_power_distribution_can_rx_event_mapperfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_CENTRE_CONSOLEfront_power_distribution_can_rx_event_mapperfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_HEADLIGHTSfront_power_distribution_can_rx_event_mapperfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_SIGNAL_LEFTblink_event_generatorfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_SIGNAL_RIGHTblink_event_generatorfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_GPIO_EVENT_SIGNAL_HAZARDblink_event_generatorfront_power_distribution_gpio1: on, 0: off
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_LEFTfront_power_distribution_can_rx_event_mapperlights_signal_fsm1: on, 0: off
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_RIGHTfront_power_distribution_can_rx_event_mapperlights_signal_fsm1: on, 0: off
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_HAZARDfront_power_distribution_can_rx_event_mapperlights_signal_fsm1: on, 0: off
FRONT_POWER_DISTRIBUTION_CURRENT_SENSE_EVENT_DATA_READYfront_power_distribution_current_measurementfront_power_distribution_publish_dataempty

Incoming CAN Messages:

Message IDData FieldsExported Enums
SYSTEM_CAN_MESSAGE_FRONT_POWERuint16_t output_bitset, uint16_t state_bitsetEEFrontPowerDistributionOutput, EEFrontPowerDistributionOutputState
SYSTEM_CAN_MESSAGE_LIGHTSuint16_t light_type_bitset, uint16_t state_bitsetEELightType, EELightState
SYSTEM_CAN_MESSAGE_LIGHTS_SYNCempty
SYSTEM_CAN_MESSAGE_HORNuint8_t horn_stateEEHornState
  • front_power_distribution
  • lights_states
  • lights_sync

Outgoing CAN Messages:

Message IDData FieldsExported Enums
SYSTEM_CAN_MESSAGE_FRONT_POWER_CURRENT_DATA

uint16_t output_bitset,

uint16_t current_data_0, 

uint16_t current_data_1, 

uint16_t current_data_2

EEFrontPowerDistributionOutput

GPIO Outputs:

#Output
Port6Headlight Right7Signal Left8Signal Right9Strobe Light10Horn11Driver Fan Left12Driver Fan Right13141516
PCA9539R I2C address (likely)Pin
1Driver Display0x74IO0_7
2Steering0x76IO1_3
3Centre Console0x76IO1_5
4Pedal0x76IO1_1
5
Headlight Left (may be more)
Front Headlights/DRL0x76IO0_5
6Signal Left0x76IO0_4
7Signal Right0x76IO0_2
8Strobe Light??
9Horn0x74IO1_7
10Driver Fan??
11Speaker0x76IO1_0
12


13