Kevin Well-Known Member Licensed User Longtime User Jun 28, 2018 #1 I use the rLiquidCrystal_I2C library and wanted to add a function to it to directly support creating a custom character. I think I am close but I end up with the following error when attempting to compile the project: no known conversion for argument 2 from 'B4R::ArrayByte* {aka B4R::Array*}' to 'uint8_t* {aka unsigned char*}' exit status 1 Click to expand... Here is the relevant code: B4R (I think this would be right if I can work out the compilation problem: Code: Dim CharMap() As Byte = Array As Byte (0x08,0x14,0x08,0x07,0x04,0x07,0x04,0x04) lcd.CreateChar (1, CharMap) rLiquidCrystal_I2C_Cust.xml: Code: <method> <name DesignerName="CreateChar">CreateChar</name> <comment>Creates a custom character to be displayed.</comment> <returntype>B4R::void</returntype> <parameter> <name>Index</name> <type>Byte</type> </parameter> <parameter> <name>CharMap</name> <type>Byte[]</type> </parameter> </method> rLiquidCrystal_I2C_Cust.cpp: Code: void B4RLiquidCrystal_I2C::CreateChar(Byte Slot, ArrayByte* CharMap) { lcd->createChar(Slot, CharMap); } rLiquidCrystal_I2C_Cust.h: Code: void CreateChar(Byte Slot, ArrayByte* CharMap); LiquidCrystal_I2C_Cust.cpp: Code: // Allows us to fill the first 8 CGRAM locations // with custom characters void LiquidCrystal_I2C::createChar(uint8_t location, uint8_t charmap[]) { location &= 0x7; // we only have 8 locations 0-7 command(LCD_SETCGRAMADDR | (location << 3)); for (int i=0; i<8; i++) { write(charmap[i]); } } LiquidCrystal_I2C_Cust.h: Code: void createChar(uint8_t, uint8_t[]);
I use the rLiquidCrystal_I2C library and wanted to add a function to it to directly support creating a custom character. I think I am close but I end up with the following error when attempting to compile the project: no known conversion for argument 2 from 'B4R::ArrayByte* {aka B4R::Array*}' to 'uint8_t* {aka unsigned char*}' exit status 1 Click to expand... Here is the relevant code: B4R (I think this would be right if I can work out the compilation problem: Code: Dim CharMap() As Byte = Array As Byte (0x08,0x14,0x08,0x07,0x04,0x07,0x04,0x04) lcd.CreateChar (1, CharMap) rLiquidCrystal_I2C_Cust.xml: Code: <method> <name DesignerName="CreateChar">CreateChar</name> <comment>Creates a custom character to be displayed.</comment> <returntype>B4R::void</returntype> <parameter> <name>Index</name> <type>Byte</type> </parameter> <parameter> <name>CharMap</name> <type>Byte[]</type> </parameter> </method> rLiquidCrystal_I2C_Cust.cpp: Code: void B4RLiquidCrystal_I2C::CreateChar(Byte Slot, ArrayByte* CharMap) { lcd->createChar(Slot, CharMap); } rLiquidCrystal_I2C_Cust.h: Code: void CreateChar(Byte Slot, ArrayByte* CharMap); LiquidCrystal_I2C_Cust.cpp: Code: // Allows us to fill the first 8 CGRAM locations // with custom characters void LiquidCrystal_I2C::createChar(uint8_t location, uint8_t charmap[]) { location &= 0x7; // we only have 8 locations 0-7 command(LCD_SETCGRAMADDR | (location << 3)); for (int i=0; i<8; i++) { write(charmap[i]); } } LiquidCrystal_I2C_Cust.h: Code: void createChar(uint8_t, uint8_t[]);
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2018 #2 Tool to generate XML: https://www.b4x.com/android/forum/threads/creating-libraries-for-b4r.65718/#content It should be: Code: lcd->createChar(Slot, (Byte*)CharMap->data); Upvote 0
Tool to generate XML: https://www.b4x.com/android/forum/threads/creating-libraries-for-b4r.65718/#content It should be: Code: lcd->createChar(Slot, (Byte*)CharMap->data);