项目作者: Podnet

项目描述 :
Mongoose os app to test MCP2515 CAN library ported from Arduino.
高级语言: C++
项目地址: git://github.com/Podnet/mcp2515-mgos-test.git
创建时间: 2020-05-24T07:17:17Z
项目社区:https://github.com/Podnet/mcp2515-mgos-test

开源协议:Other

下载


MCP2515 testing Mongoose OS app

Mongoose os app to test mcp2515 CAN library ported from Arduino.

  • Create MCP object
    1. struct MCP_CAN *mc;
  • Send message to CAN controller
    1. void can_send(void *arg)
  • Recieve messages from other CAN controller
    1. void can_recieve(void *arg)
  • Mongoose OS app intialization function

    1. enum mgos_app_init_result mgos_app_init(void)
    2. {
    3. LOG(LL_INFO, ("TCU: Adding CAN interface."));
    4. mc = mgos_mcp2515_create(10); // cs pin as input
    5. while (CAN_OK != mgos_mcp2515_begin(mc, CAN_500KBPS))
    6. {
    7. LOG(LL_INFO, ("TCU: CAN init failed"));
    8. }
    9. LOG(LL_INFO, ("TCU: CAN init ok!"));
    10. return MGOS_APP_INIT_SUCCESS;
    11. }
    12. }