Skip to content
Snippets Groups Projects
Unverified Commit 7078acfa authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #10423 from gebart/frdm-k64f/btn-macros

frdm-k64f: Define BTNx macros for user pushbuttons
parents d8cfe1f4 2b089299
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,20 @@ extern "C" ...@@ -53,6 +53,20 @@ extern "C"
#define LED2_TOGGLE (GPIOB->PTOR = LED2_MASK) #define LED2_TOGGLE (GPIOB->PTOR = LED2_MASK)
/** @} */ /** @} */
/**
* @name Button pin definitions
* @{
*/
/* SW2, SW3 will short these pins to ground when pushed. PTA4 has an external
* pull-up resistor to VDD, but there is no external pull resistor on PTC6 */
/* BTN0 is mapped to SW2 */
#define BTN0_PIN GPIO_PIN(PORT_C, 6)
#define BTN0_MODE GPIO_IN_PU
/* BTN1 is mapped to SW3 */
#define BTN1_PIN GPIO_PIN(PORT_A, 4)
#define BTN1_MODE GPIO_IN_PU
/** @} */
/** /**
* @name FXOS8700CQ 3-axis accelerometer and magnetometer bus configuration * @name FXOS8700CQ 3-axis accelerometer and magnetometer bus configuration
* @{ * @{
......
...@@ -243,6 +243,8 @@ int i2c_release(i2c_t dev); ...@@ -243,6 +243,8 @@ int i2c_release(i2c_t dev);
* @note This function is using a repeated start sequence for reading from * @note This function is using a repeated start sequence for reading from
* the specified register address. * the specified register address.
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] reg register address to read from (8- or 16-bit, * @param[in] reg register address to read from (8- or 16-bit,
* right-aligned) * right-aligned)
...@@ -269,6 +271,8 @@ int i2c_read_reg(i2c_t dev, uint16_t addr, uint16_t reg, ...@@ -269,6 +271,8 @@ int i2c_read_reg(i2c_t dev, uint16_t addr, uint16_t reg,
* @note This function is using a repeated start sequence for reading from * @note This function is using a repeated start sequence for reading from
* the specified register address. * the specified register address.
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] reg register address to read from (8- or 16-bit, * @param[in] reg register address to read from (8- or 16-bit,
* right-aligned) * right-aligned)
...@@ -294,6 +298,8 @@ int i2c_read_regs(i2c_t dev, uint16_t addr, uint16_t reg, ...@@ -294,6 +298,8 @@ int i2c_read_regs(i2c_t dev, uint16_t addr, uint16_t reg,
* @note This function is using a repeated start sequence for reading from * @note This function is using a repeated start sequence for reading from
* the specified register address. * the specified register address.
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] addr 7-bit or 10-bit device address (right-aligned) * @param[in] addr 7-bit or 10-bit device address (right-aligned)
* @param[out] data memory location to store received data * @param[out] data memory location to store received data
...@@ -316,6 +322,8 @@ int i2c_read_byte(i2c_t dev, uint16_t addr, void *data, uint8_t flags); ...@@ -316,6 +322,8 @@ int i2c_read_byte(i2c_t dev, uint16_t addr, void *data, uint8_t flags);
* @note This function is using a repeated start sequence for reading from * @note This function is using a repeated start sequence for reading from
* the specified register address. * the specified register address.
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] addr 7-bit or 10-bit device address (right-aligned) * @param[in] addr 7-bit or 10-bit device address (right-aligned)
* @param[out] data memory location to store received data * @param[out] data memory location to store received data
...@@ -337,6 +345,8 @@ int i2c_read_bytes(i2c_t dev, uint16_t addr, ...@@ -337,6 +345,8 @@ int i2c_read_bytes(i2c_t dev, uint16_t addr,
/** /**
* @brief Convenience function for writing a single byte onto the bus * @brief Convenience function for writing a single byte onto the bus
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] addr 7-bit or 10-bit device address (right-aligned) * @param[in] addr 7-bit or 10-bit device address (right-aligned)
* @param[in] data byte to write to the device * @param[in] data byte to write to the device
...@@ -355,6 +365,8 @@ int i2c_write_byte(i2c_t dev, uint16_t addr, uint8_t data, uint8_t flags); ...@@ -355,6 +365,8 @@ int i2c_write_byte(i2c_t dev, uint16_t addr, uint8_t data, uint8_t flags);
/** /**
* @brief Convenience function for writing several bytes onto the bus * @brief Convenience function for writing several bytes onto the bus
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] addr 7-bit or 10-bit device address (right-aligned) * @param[in] addr 7-bit or 10-bit device address (right-aligned)
* @param[in] data array holding the bytes to write to the device * @param[in] data array holding the bytes to write to the device
...@@ -379,6 +391,8 @@ int i2c_write_bytes(i2c_t dev, uint16_t addr, const void *data, ...@@ -379,6 +391,8 @@ int i2c_write_bytes(i2c_t dev, uint16_t addr, const void *data,
* @note This function is using a repeated start sequence for writing to the * @note This function is using a repeated start sequence for writing to the
* specified register address. * specified register address.
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] reg register address to read from (8- or 16-bit, * @param[in] reg register address to read from (8- or 16-bit,
* right-aligned) * right-aligned)
...@@ -403,6 +417,8 @@ int i2c_write_reg(i2c_t dev, uint16_t addr, uint16_t reg, ...@@ -403,6 +417,8 @@ int i2c_write_reg(i2c_t dev, uint16_t addr, uint16_t reg,
* @note This function is using a repeated start sequence for writing to the * @note This function is using a repeated start sequence for writing to the
* specified register address. * specified register address.
* *
* @pre i2c_acquire must be called before accessing the bus
*
* @param[in] dev I2C peripheral device * @param[in] dev I2C peripheral device
* @param[in] reg register address to read from (8- or 16-bit, * @param[in] reg register address to read from (8- or 16-bit,
* right-aligned) * right-aligned)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment