Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define default BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT #7748

Merged
merged 6 commits into from
Aug 8, 2017

Conversation

davids5
Copy link
Member

@davids5 davids5 commented Aug 8, 2017

This allows for the default number of I2C bus and clock speeds to be set at compile time for a given board.

This reduces the need for code calling device::I2C::set_bus_clock to just 2 defines in the board config.

David Sidrane added 6 commits August 7, 2017 15:41
  PX4_NUMBER_I2C_BUSES number of busses that the HW can support
  not all of them my be usesd. I.E. The STM32F427 has 3 I2C
  busses but only I2C1 and I2C3 are used.
…INIT

   Define the default I2C buss frequncies that are backward compatible
   with the existing code. While allowing it the defaults to be overridden
   by a board config.

   Based on the legacy STM32 code, the I2C buss numbering starts at 1.
   The bus frequency is stored in a 0 based array. If px4_i2cbus_initialize
   returns a valid device, then the _bus-1 will act as the index to the
   busses frequency.

   A board may define BOARD_NUMBER_I2C_BUSES - the number of I2C busses
   it supports* and BOARD_I2C_BUS_CLOCK_INIT to initalize the bus
   clocks for a given busses.

   BOARD_NUMBER_I2C_BUSES - the number of busses including the *highest
                            number bus. If the board has 2 I2C
                            busses I2C1 and I2C3 BOARD_NUMBER_I2C_BUSES
                            would be set to 3

   BOARD_I2C_BUS_CLOCK_INIT - Initalization for the bus frequencies
                              by bus. A call init, with a frequency
                              less then the value used for the
                              Initalization will result in the device
                              not starting becuase the buss runs too
                              fast for it.
   Used the board overrideable vlaues to define the _bus_clocks
   array and initalize it.
   Define BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT
   for I2C1-4
@LorenzMeier LorenzMeier merged commit 1af5ed9 into master Aug 8, 2017
@LorenzMeier LorenzMeier deleted the master_fmuv5_n_i2c branch August 8, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants