summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-06-24 04:17:15 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-06-24 04:17:15 +0000
commit19cb4446919dff3b0c6e5a48c9b0192c01740ecc (patch)
treef9ebc1fc443e962a428ec0f3e3ff82c427864675 /firmware/drivers
parent1910d026b1593efd37da276397d0fa157d96d877 (diff)
downloadrockbox-19cb4446919dff3b0c6e5a48c9b0192c01740ecc.tar.gz
rockbox-19cb4446919dff3b0c6e5a48c9b0192c01740ecc.zip
M:Robe 500: RTC is now working, Added some SPI flexibility per end device and modified the interrupt handler for the tsc2100 which should make it more reliable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21483 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/rtc/rtc_rx5x348ab.c6
-rw-r--r--firmware/drivers/tsc2100.c8
2 files changed, 5 insertions, 9 deletions
diff --git a/firmware/drivers/rtc/rtc_rx5x348ab.c b/firmware/drivers/rtc/rtc_rx5x348ab.c
index 2b4e17c81d..218582c8fa 100644
--- a/firmware/drivers/rtc/rtc_rx5x348ab.c
+++ b/firmware/drivers/rtc/rtc_rx5x348ab.c
@@ -36,8 +36,7 @@ void rtc_init(void)
36int rtc_read_datetime(unsigned char* buf) 36int rtc_read_datetime(unsigned char* buf)
37{ 37{
38 char command = ADDR_READ|ADDR_BURST; /* burst read from the start of the time/date reg */ 38 char command = ADDR_READ|ADDR_BURST; /* burst read from the start of the time/date reg */
39 spi_block_transfer(SPI_target_RX5X348AB, true, 39 spi_block_transfer(SPI_target_RX5X348AB, &command, 1, buf, 7);
40 &command, 1, buf, 7);
41 return 1; 40 return 1;
42} 41}
43int rtc_write_datetime(unsigned char* buf) 42int rtc_write_datetime(unsigned char* buf)
@@ -48,7 +47,6 @@ int rtc_write_datetime(unsigned char* buf)
48 data[0] = command; 47 data[0] = command;
49 for (i=1;i<8;i++) 48 for (i=1;i<8;i++)
50 data[i] = buf[i-1]; 49 data[i] = buf[i-1];
51 spi_block_transfer(SPI_target_RX5X348AB, true, 50 spi_block_transfer(SPI_target_RX5X348AB, data, 8, NULL, 0);
52 data, 8, NULL, 0);
53 return 1; 51 return 1;
54} 52}
diff --git a/firmware/drivers/tsc2100.c b/firmware/drivers/tsc2100.c
index 271a557822..32a3516e9d 100644
--- a/firmware/drivers/tsc2100.c
+++ b/firmware/drivers/tsc2100.c
@@ -44,7 +44,7 @@ void tsc2100_read_data(void)
44 44
45 adc_last_read=current_tick; 45 adc_last_read=current_tick;
46 46
47 spi_block_transfer(SPI_target_TSC2100, false, 47 spi_block_transfer(SPI_target_TSC2100,
48 out, sizeof(out), (char *)adc_data, sizeof(adc_data)); 48 out, sizeof(out), (char *)adc_data, sizeof(adc_data));
49 49
50 for(i=0; i<sizeof(adc_data); i+=2) 50 for(i=0; i<sizeof(adc_data); i+=2)
@@ -128,8 +128,7 @@ short tsc2100_readreg(int page, int address)
128 unsigned short command = 0x8000|(page << 11)|(address << 5); 128 unsigned short command = 0x8000|(page << 11)|(address << 5);
129 unsigned char out[] = {command >> 8, command & 0xff}; 129 unsigned char out[] = {command >> 8, command & 0xff};
130 unsigned char in[2]; 130 unsigned char in[2];
131 spi_block_transfer(SPI_target_TSC2100, false, 131 spi_block_transfer(SPI_target_TSC2100, out, sizeof(out), in, sizeof(in));
132 out, sizeof(out), in, sizeof(in));
133 return (in[0]<<8)|in[1]; 132 return (in[0]<<8)|in[1];
134} 133}
135 134
@@ -139,8 +138,7 @@ void tsc2100_writereg(int page, int address, short value)
139 unsigned short command = (page << 11)|(address << 5); 138 unsigned short command = (page << 11)|(address << 5);
140 unsigned char out[4] = {command >> 8, command & 0xff, 139 unsigned char out[4] = {command >> 8, command & 0xff,
141 value >> 8, value & 0xff}; 140 value >> 8, value & 0xff};
142 spi_block_transfer(SPI_target_TSC2100, false, 141 spi_block_transfer(SPI_target_TSC2100, out, sizeof(out), NULL, 0);
143 out, sizeof(out), NULL, 0);
144} 142}
145 143
146void tsc2100_keyclick(void) 144void tsc2100_keyclick(void)