first cut at turnon scripts for EasyTimer v2
[fw/altos] / src / drivers / ao_m25.c
index 2e4cbedf989d23991c54245b6a6a18d392e2d1b1..4be91e13b7599cedd73f7778134d7187d51a7e1d 100644 (file)
@@ -101,7 +101,7 @@ static uint8_t ao_m25_mutex;
 
 static uint8_t ao_m25_instruction[4];
 
-#define AO_M25_SPI_SPEED       ao_spi_speed(10000000)  /* this seems like a reasonable minimum speed to require */
+#define AO_M25_SPI_SPEED       ao_spi_speed(AO_M25_SPI_BUS, 10000000)  /* this seems like a reasonable minimum speed to require */
 
 #define M25_SELECT(cs)         ao_spi_get_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS,AO_M25_SPI_SPEED)
 #define M25_DESELECT(cs)       ao_spi_put_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS)
@@ -125,7 +125,7 @@ ao_m25_wait_wip(ao_port_t cs)
                        ao_spi_recv(ao_m25_instruction, 1, AO_M25_SPI_BUS);
                } while (ao_m25_instruction[0] & M25_STATUS_WIP);
                M25_DESELECT(cs);
-               ao_m25_wip &= ~cs;
+               ao_m25_wip &= (ao_port_t) ~cs;
        }
 }
 
@@ -192,9 +192,9 @@ ao_m25_set_address(uint32_t pos)
 #endif
        ao_m25_wait_wip(mask);
 
-       ao_m25_instruction[1] = pos >> 16;
-       ao_m25_instruction[2] = pos >> 8;
-       ao_m25_instruction[3] = pos;
+       ao_m25_instruction[1] = (uint8_t) (pos >> 16);
+       ao_m25_instruction[2] = (uint8_t) (pos >> 8);
+       ao_m25_instruction[3] = (uint8_t) (pos);
        return mask;
 }