Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Quick Links:

Architecture:

It would make sense to keep the firmware of this board pretty simple, the board does not need to know about the car's power states. It can simply receive CAN messages and act upon them.

Modules:

  • 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

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

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_mappersignal_lights_fsm1: on, 0: off
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_RIGHTfront_power_distribution_can_rx_event_mappersignal_lights_fsm1: on, 0: off
FRONT_POWER_DISTRIBUTION_SIGNAL_EVENT_HAZARDfront_power_distribution_can_rx_event_mappersignal_lights_fsm1: on, 0: off
FRONT_POWER_DISTRIBUTION_CURRENT_SENSE_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:

#OutputPortPin
1Driver Display (Output)B2
2SteeringA10
3Centre ConsoleA8
4PedalA9
5Headlight Left (may be more)

6Headlight Right

7Signal LeftB13
8Signal RightB12
9Strobe Light

10HornB14
11Driver Fan LeftB15
12Driver Display (Current sensing)A1
13Horn (Current sensing)A4
14


15


  • No labels