I am trying to calculate the RMS value, but i need to offset by 512,
I get the raw value from 0 to 1024, i need subtract 512 from this number and then square the number, but i get warnings
I get warning on the last two lines,Code:void Rms(uint16 rawcount) { uint16_t l_temp_rawcount_u16 = 0; uint32_t l_temp_square_u32=0; int16_t l_temp_offset_s16 =0; l_temp_rawcount_u16 = rawcount; l_temp_offset_s16 = l_temp_rawcount_u16 - 512u; l_temp_square_u32 = l_temp_offset_s16 * l_temp_offset_s16 ; }
warning: implicit conversion changes signedness: 'unsigned int' to 'int16_t' (aka 'short') [-Wsign-conversion]
warning: implicit conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned long') [-Wsign-conversion]