Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@BrendanKelly84213
Copy link
Contributor

Description (tell us what you changes or added or removed please)

This is a start for I2C "wrapper" or whatever. Not written in stone or anything, but it works and is a good place to get started with. I didn't add changes to build system or anything like that as I am hoping we are switching to CMake within the next couple of days. Just the header and source files.

How to test (if any tests done)

Here's the example main file I was using for testing

#define SLAVE_ADDR 0x08

int main(void)
{
	/* Initializes MCU, drivers and middleware */
	atmel_start_init();
	CommsDrive_Init(SLAVE_ADDR);

	/* Replace with your application code */
	static const uint8_t size = 5;
	uint8_t rx_buf[size];
	uint8_t pwm_buff[5] = {99, 99, 99, 99};
	volatile int32_t returnValue = ETINYPROTOCOL_SUCCESS;
	while (1) {
		gpio_toggle_pin_level(LED0);
		returnValue = CommsDrive_ProcessTeleRequest(SLAVE_ADDR, 0x01, rx_buf, size);
		delay_ms(100);
	}
}

This just gets the system status and firmware version from BMS, since those should be static values and are easy to check. BMS has to be current for this to work, in other words #77 has to have been merged. You can look at the values with a debugger or use the logic analyzer, whatever you want.

Checklist

  • Code Compiles
  • Did you add any comments
  • Did you test it at all ?! Good Boy/Girl

@BrendanKelly84213 BrendanKelly84213 self-assigned this Nov 1, 2025
@BrendanKelly84213 BrendanKelly84213 marked this pull request as ready for review November 1, 2025 17:36
TINYPROTOCOL_Initialize();
}

void CommsDrive_ProcessTeleRequest(uint8_t slaveAddr, uint8_t request, uint8_t* rx_buf, uint8_t len)
Copy link
Collaborator

@dqwed01 dqwed01 Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a function header just quickly explain what this is doing and why. Same thing for any additional complex functions moving forward

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait you want a description of how this works? Added a comment in the header describing what it does. Is something not clear in the implementation? Let me know what if so I can add a little inline explenation

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an inline approach would be better, explaining the the purpose of the code and what kind of output you'd expect from it. Doesn't have to be super lengthy, just a small description so we're not completely lost trying to understand the code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything specific?

This is a start for I2C "wrapper" or whatever. Not written in stone or
anything, but it works and is a good place to get started with.
@BrendanKelly84213 BrendanKelly84213 force-pushed the feature/cdh/bk-tinyprotocol-no-toolchain branch from c8dbc63 to 405cdc8 Compare November 1, 2025 18:27
@BrendanKelly84213 BrendanKelly84213 marked this pull request as draft November 1, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants