altos/lpc: Add casts to reduce -Wconversion warnings
[fw/altos] / src / lpc / ao_adc_lpc.c
index 26a5ea08c73df808bd01420eb9b3588d3978b67c..c5a703c23da26fd19cb4c747534c95b6f7849fec 100644 (file)
@@ -92,7 +92,7 @@ static const uint8_t  ao_adc_mask_seq[AO_ADC_NUM] = {
 #define sample(id)     (*out++ = (uint16_t) lpc_adc.dr[id] >> 1)
 
 static inline void lpc_adc_start(void) {
-       lpc_adc.cr = ((ao_adc_mask_seq[ao_adc_sequence] << LPC_ADC_CR_SEL) |
+       lpc_adc.cr = (((uint32_t) ao_adc_mask_seq[ao_adc_sequence] << LPC_ADC_CR_SEL) |
                      (AO_ADC_CLKDIV << LPC_ADC_CR_CLKDIV) |
                      (0 << LPC_ADC_CR_BURST) |
                      (LPC_ADC_CR_CLKS_11 << LPC_ADC_CR_CLKS) |
@@ -112,23 +112,7 @@ void  lpc_adc_isr(void)
        }
 
        AO_DATA_PRESENT(AO_DATA_ADC);
-       if (ao_data_present == AO_DATA_ALL) {
-#if HAS_MS5607
-               ao_data_ring[ao_data_head].ms5607_raw = ao_ms5607_current;
-#endif
-#if HAS_MMA655X
-               ao_data_ring[ao_data_head].mma655x = ao_mma655x_current;
-#endif
-#if HAS_HMC5883
-               ao_data_ring[ao_data_head].hmc5883 = ao_hmc5883_current;
-#endif
-#if HAS_MPU6000
-               ao_data_ring[ao_data_head].mpu6000 = ao_mpu6000_current;
-#endif
-               ao_data_ring[ao_data_head].tick = ao_tick_count;
-               ao_data_head = ao_data_ring_next(ao_data_head);
-               ao_wakeup((void *) &ao_data_head);
-       }
+       ao_data_fill(ao_data_head);
        ao_adc_ready = 1;
 }
 
@@ -147,7 +131,7 @@ ao_adc_poll(void)
 }
 
 static void
-ao_adc_dump(void) __reentrant
+ao_adc_dump(void) 
 {
        struct ao_data  packet;
 #ifndef AO_ADC_DUMP
@@ -167,7 +151,7 @@ ao_adc_dump(void) __reentrant
 #endif
 }
 
-__code struct ao_cmds ao_adc_cmds[] = {
+const struct ao_cmds ao_adc_cmds[] = {
        { ao_adc_dump,  "a\0Display current ADC values" },
        { 0, NULL },
 };
@@ -176,7 +160,7 @@ void
 ao_adc_init(void)
 {
        lpc_scb.sysahbclkctrl |= (1 << LPC_SCB_SYSAHBCLKCTRL_ADC);
-       lpc_scb.pdruncfg &= ~(1 << LPC_SCB_PDRUNCFG_ADC_PD);
+       lpc_scb.pdruncfg &= ~(1UL << LPC_SCB_PDRUNCFG_ADC_PD);
 
        /* Enable interrupt when channel is complete */
        lpc_adc.inten = (1 << LPC_ADC_INTEN_ADGINTEN);