Skip to content

Commit 7c5b9b2

Browse files
committed
altos/micropeak-v2.0: Add casts to reduce -Wconversion warnings
No bugs identified Signed-off-by: Keith Packard <[email protected]>
1 parent e80a45c commit 7c5b9b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/micropeak-v2.0/ao_micro.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ ao_pa_get(void)
5050

5151
ao_ms5607_sample(&ao_ms5607_current);
5252
ao_ms5607_convert(&ao_ms5607_current, &value);
53-
pa = value.pres;
53+
pa = (uint32_t) value.pres;
5454
}
5555

5656
static void
5757
ao_compute_height(void)
5858
{
59-
ground_alt = ao_pa_to_altitude(pa_ground);
60-
max_alt = ao_pa_to_altitude(pa_min);
59+
ground_alt = ao_pa_to_altitude((pres_t) pa_ground);
60+
max_alt = ao_pa_to_altitude((pres_t) pa_min);
6161
ao_max_height = max_alt - ground_alt;
6262
}
6363

@@ -91,7 +91,7 @@ power_down(void)
9191
stm_scb.scr |= ((1 << STM_SCB_SCR_SLEEPDEEP) |
9292
(1 << STM_SCB_SCR_SLEEPONEXIT));
9393
stm_pwr.cr |= (1 << STM_PWR_CR_PDDS);
94-
stm_pwr.csr &= ~(1 << STM_PWR_CSR_WUF);
94+
stm_pwr.csr &= ~(1UL << STM_PWR_CSR_WUF);
9595
ao_arch_wait_interrupt();
9696
}
9797
}
@@ -144,7 +144,7 @@ flight_mode(void)
144144
ao_report_altitude();
145145
ao_pips();
146146
log_micro_dump();
147-
#if BOOST_DELAY
147+
#ifdef BOOST_DELAY
148148
ao_delay(BOOST_DELAY);
149149
#endif
150150
log_erase();
@@ -212,7 +212,7 @@ main(void)
212212
*/
213213
uint16_t vref = ao_adc_read_vref();
214214

215-
uint32_t vdda = 3 * stm_vrefint_cal.vrefint_cal * 1000 / vref;
215+
uint32_t vdda = 3UL * stm_vrefint_cal.vrefint_cal * 1000 / vref;
216216

217217
/* Power supply > 3.25V means we're on USB power */
218218
if (vdda > 3250) {

0 commit comments

Comments
 (0)