Hi there, i'm new to atmel programming, and i need to modify arduino library LiquidCrystal_1602_RUS to insert it to existing project cheali-charger.
#include "LiquidCrystal_1602_RUS.h"
wchar_t char_utf8[] = L" ";
//user_custom_symbols - количество символов, доступное пользователю для использования в своих целях (не более 8)
//Всего переопределяемых символов в LCD - 8.
//Символы с индексом от 0 до (7 - user_custom_symbols) используются библиотекой
//Символы с индексом от (8 - user_custom_symbols) до 7 - можно переопределять пользователю
//По умолчанию количество переопределяемых символов равно 0
LiquidCrystal_1602_RUS :: LiquidCrystal_1602_RUS(uint8_t rs, uint8_t enable,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t user_custom_symbols) : LiquidCrystal (rs, enable, d0, d1, d2, d3)
{
max_symbol_count = 8 - user_custom_symbols;
symbol_index = 0;
cursor_col = 0;
cursor_row = 0;
ResetAllIndex();//Сброс значений индексов (неинициализированы = 255)
}
void LiquidCrystal_1602_RUS::clear()
{
This file has been truncated. show original
/*
cheali-charger - open source firmware for a variety of LiPo chargers
Copyright (C) 2013 Paweł Stawicki. All right reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "LiquidCrystal.h"
#include <stdio.h>
This file has been truncated. show original
So i'm a bit confused...
I have a function:
void LiquidCrystal_1602_RUS::print(const wchar_t *_str){
in cheali-charger:
uint8_t LiquidCrystal::print(const char str[])
looks like missmatch of string types
So i'm stuck with this:
D:/Cheali/cheali-charger-master/src/core/drivers/LiquidCrystal.cpp: In member function 'uint8_t LiquidCrystal::print(const char*)':
D:/Cheali/cheali-charger-master/src/core/drivers/LiquidCrystal.cpp:359:12: warning: case label value exceeds maximum value for type
case 1041: //╨С
uint8_t LiquidCrystal::print(const char str[])
{
uint8_t rus_[8];
int current_char = 0;
int size = 0;
/*while(str[size] != NULL)
{
size++;
}*/
size = strlen(str);
while(current_char < size)
{
switch(str[current_char])
{
case 1041: //Б
memcpy_PF(rus_, (uint32_t)rus_B, 8);
CharSetToLCD((uint8_t *)rus_, &index_rus_B);
break;
So error on this line: case 1041
How to convert char to to numeric code (1041) ?
If you want to store unicode characters in str[], you need to use a datatype that can hold 16 bits.
aarg:
If you want to store unicode characters in str[], you need to use a datatype that can hold 16 bits.
It allready stores as it old workingg code and now i need to convert symbols to 4 digits code, how can i do this?
system
May 19, 2016, 10:25am
4
how can i do this?
Look at the two different declarations you posted:
void LiquidCrystal_1602_RUS::print(const wchar_t *_str)
and
uint8_t LiquidCrystal::print(const char str[])
A wchar_t is 16 bits. A char is 8 bits. An 8 bit value (str[current_char]) can NOT hold a value of 1041 when str is a char array. It CAN when str is a wchar_t array.