Transmit buffer
This commit is contained in:
@@ -43,9 +43,11 @@ void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t transferDirection, ui
|
||||
HAL_I2C_Slave_Seq_Receive_DMA(hi2c, receivingBuffer + receivingBufferDataSize, 1, I2C_NEXT_FRAME);
|
||||
}else{
|
||||
slaveMode = Transmitting;
|
||||
transmittingBuffer[0] = 0x55;
|
||||
transmittingBufferDataSize = 1;
|
||||
HAL_I2C_Slave_Seq_Transmit_DMA(hi2c, transmittingBuffer, transmittingBufferDataSize, I2C_LAST_FRAME);
|
||||
if(transmittingBufferDataSize){
|
||||
HAL_I2C_Slave_Seq_Transmit_DMA(hi2c, transmittingBuffer, transmittingBufferDataSize, I2C_LAST_FRAME);
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +70,7 @@ void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||
}
|
||||
|
||||
void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||
transmittingBufferDataSize = 0;
|
||||
//transmittingBufferDataSize = 0;
|
||||
}
|
||||
|
||||
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) {
|
||||
@@ -76,9 +78,15 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) {
|
||||
}
|
||||
|
||||
void Start(){
|
||||
uint8_t byte[4] = {33, 34, 35, 36};
|
||||
HAL_I2C_EnableListen_IT(&hi2c3);
|
||||
while(1){
|
||||
HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);
|
||||
HAL_Delay(10000);
|
||||
transmit(byte, 3);
|
||||
byte[0]++;
|
||||
byte[1]++;
|
||||
byte[2]++;
|
||||
byte[3]++;
|
||||
HAL_Delay(500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ static void MX_I2C3_Init(void)
|
||||
hi2c3.Instance = I2C3;
|
||||
hi2c3.Init.ClockSpeed = 100000;
|
||||
hi2c3.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
||||
hi2c3.Init.OwnAddress1 = 126;
|
||||
hi2c3.Init.OwnAddress1 = 32;
|
||||
hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
hi2c3.Init.OwnAddress2 = 0;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
/* Variables */
|
||||
extern int __io_putchar(int ch) __attribute__((weak));
|
||||
@@ -80,7 +80,7 @@ __attribute__((weak)) int _write(int file, char *ptr, int len)
|
||||
|
||||
for (DataIdx = 0; DataIdx < len; DataIdx++)
|
||||
{
|
||||
__io_putchar(*ptr++);
|
||||
ITM_SendChar(*ptr++);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user