Use explicitly sized types from stdint

Replace bare int types with stdint types. This was done with:

    grep -rwl 'int' src/ | xargs sed -i 's/\<int\>/int16_t/g'
    grep -rwl 'unsigned long' src/ | xargs sed -i 's/\<unsigned long\>/uint32_t/g'
    grep -rwl 'unsigned char' src/ | xargs sed -i 's/\<unsigned char\>/uint8_t/g'

Then reverted for *main(), putchar(), and getchar().

The Arduino declarations for parallel_main() were also corrected to
match their definitions.

SDCC does *not* generate the same code in all instances, due to `int`
being treated different than `short int`.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2021-07-28 07:36:42 -06:00
committed by Jeremy Soller
parent 38b2a628f9
commit 99af8a35f5
41 changed files with 169 additions and 167 deletions

View File

@@ -26,7 +26,7 @@ void fan_reset(void) {
// Get duty cycle based on temperature, adapted from
// https://github.com/pop-os/system76-power/blob/master/src/fan.rs
uint8_t fan_duty(const struct Fan * fan, int16_t temp) __reentrant {
for (int i = 0; i < fan->points_size; i++) {
for (int16_t i = 0; i < fan->points_size; i++) {
const struct FanPoint * cur = &fan->points[i];
// If exactly the current temp, return the current duty
@@ -86,7 +86,7 @@ void fan_duty_set(uint8_t peci_fan_duty, uint8_t dgpu_fan_duty) __reentrant {
uint8_t fan_heatup(const struct Fan * fan, uint8_t duty) __reentrant {
uint8_t lowest = duty;
int i;
int16_t i;
for (i = 0; (i + 1) < fan->heatup_size; i++) {
uint8_t value = fan->heatup[i + 1];
if (value < lowest) {
@@ -102,7 +102,7 @@ uint8_t fan_heatup(const struct Fan * fan, uint8_t duty) __reentrant {
uint8_t fan_cooldown(const struct Fan * fan, uint8_t duty) __reentrant {
uint8_t highest = duty;
int i;
int16_t i;
for (i = 0; (i + 1) < fan->cooldown_size; i++) {
uint8_t value = fan->cooldown[i + 1];
if (value > highest) {