aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FT245.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/FT245.c b/FT245.c
index b30c443..d0d417d 100644
--- a/FT245.c
+++ b/FT245.c
@@ -8,8 +8,10 @@ static void data_out(ft245_t *ft245);
static void data_in(ft245_t *ft245);
static void bit_set(ft245_t *ft245, uint8_t bit);
static void bit_reset(ft245_t *ft245, uint8_t bit);
+static bool byte_enabled_get(ft245_t *ft245, uint8_t byte);
+static void byte_enabled_set(ft245_t *ft245, uint8_t byte, bool enabled);
static bool full_word_enabled(ft245_t *ft245);
-static bool read_byte(ft245_t *ft245, uint8_t byte, uint8_t *value);
+static bool byte_read(ft245_t *ft245, uint8_t byte, uint8_t *value);
static bool tx_word(ft245_t *ft245);
static bool rx_word(ft245_t *ft245);
@@ -699,7 +701,7 @@ static bool full_word_enabled(ft245_t *ft245)
#endif // (FT245_DRIVER_MODE_STATIC == 1)
}
-static bool read_byte(ft245_t *ft245, uint8_t byte, uint8_t *value)
+static bool byte_read(ft245_t *ft245, uint8_t byte, uint8_t *value)
{
#if(FT245_DRIVER_MODE_DYNAMIC == 1)
switch(byte) {
@@ -878,7 +880,7 @@ static bool rx_word(ft245_t *ft245)
uint8_t data[4];
for(uint8_t i = 0; i < 4; i++)
- read_byte(ft245, i, &data[i]);
+ byte_read(ft245, i, &data[i]);
cb_push(ft245->buffer_rx, data[3]);
cb_push(ft245->buffer_rx, data[2]);
@@ -892,7 +894,7 @@ static bool rx_word(ft245_t *ft245)
return true;
}
-void ft245_init(ft245_t *ft245)
+void FT245_init(ft245_t *ft245)
{
data_in(ft245);
@@ -903,7 +905,7 @@ void ft245_init(ft245_t *ft245)
ft245->clk_count = 0;
}
-void ft245_periodic(ft245_t *ft245)
+void FT245_periodic(ft245_t *ft245)
{
static size_t oe_n = 0;
static size_t rd_n = 0;
@@ -996,7 +998,7 @@ void ft245_periodic(ft245_t *ft245)
#endif // (FT245_DRIVER_MODE_STATIC == 1)
}
-bool ft245_write_buffered(ft245_t *ft245, uint8_t *data, size_t size)
+bool FT245_write_buffered(ft245_t *ft245, uint8_t *data, size_t size)
{
if(cb_full(ft245->buffer_tx))
return false;
@@ -1010,7 +1012,7 @@ bool ft245_write_buffered(ft245_t *ft245, uint8_t *data, size_t size)
return true;
}
-bool ft245_read_buffered(ft245_t *ft245, uint8_t *data, size_t size)
+bool FT245_read_buffered(ft245_t *ft245, uint8_t *data, size_t size)
{
if(cb_occupation(ft245->buffer_rx) < size)
return false;
@@ -1021,7 +1023,7 @@ bool ft245_read_buffered(ft245_t *ft245, uint8_t *data, size_t size)
return true;
}
-bool ft245_write_word_buffered(ft245_t *ft245, uint32_t word)
+bool FT245_write_word_buffered(ft245_t *ft245, uint32_t word)
{
while(atomic_flag_test_and_set_explicit(&lock, memory_order_acquire));
if(cb_size(ft245->buffer_tx) - cb_occupation(ft245->buffer_tx) < 4) {
@@ -1039,7 +1041,7 @@ bool ft245_write_word_buffered(ft245_t *ft245, uint32_t word)
return true;
}
-bool ft245_read_word_buffered(ft245_t *ft245, uint32_t *word)
+bool FT245_read_word_buffered(ft245_t *ft245, uint32_t *word)
{
while(atomic_flag_test_and_set_explicit(&lock, memory_order_acquire));
if(cb_occupation(ft245->buffer_rx) < 4) {
@@ -1062,12 +1064,12 @@ bool ft245_read_word_buffered(ft245_t *ft245, uint32_t *word)
return true;
}
-size_t ft245_available_read(ft245_t *ft245)
+size_t FT245_available_read(ft245_t *ft245)
{
return cb_occupation(ft245->buffer_rx);
}
-size_t ft245_available_write(ft245_t *ft245)
+size_t FT245_available_write(ft245_t *ft245)
{
return (cb_size(ft245->buffer_tx) - cb_occupation(ft245->buffer_tx));
} \ No newline at end of file