On 18.01.2008 03:00, Carl-Daniel Hailfinger wrote:
Nice. I have restructured your patch a bit, but I'd like to improve even further. Could you take a look at all those places where you added "const unsigned char cmd[] = XXX" and use #defines for commands like those at the top of spi.c? That would improve readability of the code.
I was unclear. I mean stuff like this:
void spi_write_status_register(int status) { const unsigned char cmd[] = {0x01,(unsigned char)status}; /* Send WRSR (Write Status Register) */ generic_spi_command(2, 0, cmd, NULL); }
would probably be more readable if it looked like this:
void spi_write_status_register(int status) { const unsigned char cmd[] = {JEDEC_WRSR,(unsigned char)status}; /* Send WRSR (Write Status Register) */ generic_spi_command(JEDEC_WRSR_OUTSIZE, JEDEC_WRSR_INSIZE, cmd, NULL); }
Regards, Carl-Daniel