Skip to content

Commit

Permalink
contrib/firmware: add 'send not acknowledged' function to the i2c bit…
Browse files Browse the repository at this point in the history
…-banging implementation

Change-Id: I60597ebc126da4acb00654513b96f52261253e12
Signed-off-by: Ahmed BOUDJELIDA <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/7811
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
  • Loading branch information
Ahmed BOUDJELIDA authored and borneoa committed Nov 18, 2023
1 parent a69a4e2 commit bb27677
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/firmware/angie/c/include/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void repeated_start(void);
void stop_cd(void);
void clock_cd(void);
void send_ack(void);
void send_nack(void);
bool get_ack(void);

uint8_t get_address(uint8_t adr, uint8_t rdwr);
Expand Down
10 changes: 10 additions & 0 deletions contrib/firmware/angie/c/src/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ void send_ack(void)
delay_us(1);
}

void send_nack(void)
{
PIN_SDA = 1;
delay_us(1);
PIN_SCL = 1;
delay_us(1);
PIN_SCL = 0;
delay_us(1);
}

bool get_ack(void)
{
PIN_SDA_DIR = 1;
Expand Down
3 changes: 3 additions & 0 deletions contrib/firmware/angie/c/src/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,9 @@ void i2c_recieve(void)

EP8FIFOBUF[count - 1] = receive_byte();

/* send Nack: */
send_nack();

/* stop */
stop_cd();

Expand Down

0 comments on commit bb27677

Please sign in to comment.