| #define I2C_PERIPHERAL_FRQ (MIOS32_SYS_CPU_FREQUENCY/4) |
| #define MIOS32_IIC0_DUTYCYCLE I2C_DutyCycle_2 |
| #define MIOS32_IIC0_SCL_PIN GPIO_Pin_10 |
| #define MIOS32_IIC0_SCL_PORT GPIOB |
| #define MIOS32_IIC0_SDA_PIN GPIO_Pin_11 |
| #define MIOS32_IIC0_SDA_PORT GPIOB |
| #define MIOS32_IIC1_DUTYCYCLE I2C_DutyCycle_2 |
| #define MIOS32_IIC1_SCL_PIN GPIO_Pin_6 |
| #define MIOS32_IIC1_SCL_PORT GPIOB |
| #define MIOS32_IIC1_SDA_PIN GPIO_Pin_7 |
| #define MIOS32_IIC1_SDA_PORT GPIOB |
| void I2C0_IRQHandler | ( | void | ) |
| void I2C2_ER_IRQHandler | ( | void | ) |
| void I2C2_EV_IRQHandler | ( | void | ) |
Initializes IIC driver
| [in] | mode | currently only mode 0 supported |
Returns the last transfer error
Will be updated by MIOS32_IIC_TransferCheck(), so that the error status doesn't get lost (the check function will return 0 when called again)
Will be cleared when a new transfer has been started successfully
| [in] | iic_port | the IIC port (0..MIOS32_IIC_NUM-1) |
| s32 MIOS32_IIC_Transfer | ( | u8 | iic_port, | |
| mios32_iic_transfer_t | transfer, | |||
| u8 | address, | |||
| u8 * | buffer, | |||
| u16 | len | |||
| ) |
Starts a new transfer. If this function is called during an ongoing transfer, we wait until it has been finished and setup the new transfer
| [in] | transfer | type:
|
| [in] | iic_port | the IIC port (0..MIOS32_IIC_NUM-1) |
| [in] | address | of IIC device (bit 0 always cleared) |
| [in] | *buffer | pointer to transmit/receive buffer |
| [in] | len | number of bytes which should be transmitted/received |
< 0 on errors, if MIOS32_IIC_ERROR_PREV_OFFSET is added, the previous transfer got an error (the previous task didn't use MIOS32_IIC_TransferWait to poll the transfer state)
| s32 MIOS32_IIC_TransferBegin | ( | u8 | iic_port, | |
| mios32_iic_semaphore_t | semaphore_type | |||
| ) |
Semaphore handling: requests the IIC interface
| [in] | iic_port | the IIC port (0..MIOS32_IIC_NUM-1) |
| [in] | semaphore_type | is either IIC_Blocking or IIC_Non_Blocking |
0 if IIC interface free
Checks if transfer is finished
| [in] | iic_port | the IIC port (0..MIOS32_IIC_NUM-1) |
1 if ongoing transfer
< 0 if error during transfer
Semaphore handling: releases the IIC interface for other tasks
| [in] | iic_port | the IIC port (0..MIOS32_IIC_NUM-1) |
Waits until transfer is finished
| [in] | iic_port | the IIC port (0..MIOS32_IIC_NUM-1) |
< 0 if error during transfer
| volatile u32 MIOS32_IIC_unexpected_event |
| volatile u32 MIOS32_IIC_unexpected_event |
1.4.7