Followup to HAL optimizations and delays
- Cleanups, fixes for Due HAL code. - TC_IER is write-only. Use TC_IMR to test ISR state.
This commit is contained in:
@ -118,12 +118,12 @@ uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity) {
|
||||
// perform blocking read into buffer
|
||||
I2C_M_SETUP_Type transferMCfg;
|
||||
transferMCfg.sl_addr7bit = address >> 1; // not sure about the right shift
|
||||
transferMCfg.tx_data = NULL;
|
||||
transferMCfg.tx_length = 0;
|
||||
transferMCfg.rx_data = rxBuffer;
|
||||
transferMCfg.rx_length = quantity;
|
||||
transferMCfg.retransmissions_max = 3;
|
||||
I2C_MasterTransferData(I2CDEV_M, &transferMCfg, I2C_TRANSFER_POLLING);
|
||||
transferMCfg.tx_data = NULL;
|
||||
transferMCfg.tx_length = 0;
|
||||
transferMCfg.rx_data = rxBuffer;
|
||||
transferMCfg.rx_length = quantity;
|
||||
transferMCfg.retransmissions_max = 3;
|
||||
I2C_MasterTransferData(I2CDEV_M, &transferMCfg, I2C_TRANSFER_POLLING);
|
||||
|
||||
// set rx buffer iterator vars
|
||||
rxBufferIndex = 0;
|
||||
@ -154,11 +154,11 @@ uint8_t TwoWire::endTransmission(void) {
|
||||
// transmit buffer (blocking)
|
||||
I2C_M_SETUP_Type transferMCfg;
|
||||
transferMCfg.sl_addr7bit = txAddress >> 1; // not sure about the right shift
|
||||
transferMCfg.tx_data = txBuffer;
|
||||
transferMCfg.tx_length = txBufferLength;
|
||||
transferMCfg.rx_data = NULL;
|
||||
transferMCfg.rx_length = 0;
|
||||
transferMCfg.retransmissions_max = 3;
|
||||
transferMCfg.tx_data = txBuffer;
|
||||
transferMCfg.tx_length = txBufferLength;
|
||||
transferMCfg.rx_data = NULL;
|
||||
transferMCfg.rx_length = 0;
|
||||
transferMCfg.retransmissions_max = 3;
|
||||
Status status = I2C_MasterTransferData(I2CDEV_M, &transferMCfg, I2C_TRANSFER_POLLING);
|
||||
|
||||
// reset tx buffer iterator vars
|
||||
|
@ -60,6 +60,7 @@
|
||||
//#include "Configuration.h"
|
||||
|
||||
#include <U8glib.h>
|
||||
#include "../Delay.h"
|
||||
|
||||
#define SPI_FULL_SPEED 0
|
||||
#define SPI_HALF_SPEED 1
|
||||
@ -92,8 +93,7 @@
|
||||
/* data */
|
||||
spiSend(0x0FA);
|
||||
|
||||
for( i = 0; i < 4; i++ ) // give the controller some time to process the data
|
||||
u8g_10MicroDelay(); // 2 is bad, 3 is OK, 4 is safe
|
||||
DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
|
||||
}
|
||||
|
||||
spiSend(val & 0x0F0);
|
||||
|
@ -57,6 +57,7 @@
|
||||
|
||||
#include <U8glib.h>
|
||||
#include "SoftwareSPI.h"
|
||||
#include "../Delay.h"
|
||||
|
||||
#define SPI_SPEED 3 // About 1 MHz
|
||||
|
||||
@ -78,8 +79,7 @@
|
||||
/* data */
|
||||
swSpiTransfer(0x0FA, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
|
||||
|
||||
for( i = 0; i < 4; i++ ) // give the controller some time to process the data
|
||||
u8g_10MicroDelay(); // 2 is bad, 3 is OK, 4 is safe
|
||||
DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
|
||||
}
|
||||
|
||||
swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
|
||||
|
Reference in New Issue
Block a user