mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
For new LCD firmware, drop need to limit data to 31 bytes
The previous Mizar32 LCD firmware had a limit of 31 bytes per data message, while the new has no limit. This commit drops the code that used to split long data transfers into 31-byte chunks.
This commit is contained in:
parent
991bcec20d
commit
fb1d9c464c
@ -43,21 +43,15 @@ static void lcd_stop()
|
|||||||
// "address" is LCD_CMD for LCD commands, LCD_DATA for LCD data.
|
// "address" is LCD_CMD for LCD commands, LCD_DATA for LCD data.
|
||||||
static int send_generic( u8 address, const u8 *data, int len )
|
static int send_generic( u8 address, const u8 *data, int len )
|
||||||
{
|
{
|
||||||
|
lcd_start();
|
||||||
|
i2c_start_cond();
|
||||||
|
i2c_write_byte( address );
|
||||||
while ( len > 0 ) {
|
while ( len > 0 ) {
|
||||||
int nbytes; // number of bytes sent in this I2C packet
|
i2c_write_byte( *data++ );
|
||||||
|
len--;
|
||||||
lcd_start();
|
|
||||||
i2c_start_cond();
|
|
||||||
i2c_write_byte( address );
|
|
||||||
// Mizar32 LCD module has a maximum of 31 bytes per data packet
|
|
||||||
nbytes = 0;
|
|
||||||
while ( len > 0 && nbytes < 31 ) {
|
|
||||||
i2c_write_byte( *data++ );
|
|
||||||
nbytes++; len--;
|
|
||||||
}
|
|
||||||
i2c_stop_cond();
|
|
||||||
lcd_stop();
|
|
||||||
}
|
}
|
||||||
|
i2c_stop_cond();
|
||||||
|
lcd_stop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user