Pavilion1984:
Display_RPM = ~((1 << (16 - temp))-1) | ((1 << temp)-1);
As a style issue, it is generally better to do such shifts as unsigned. If you use the U/u suffix on the 1's, the resulting type of the operation is unsigned:
Display_RPM = ~((1u << (16 - temp))-1u) | ((1u << temp)-1);