Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem max32630fthr USBDevice
AVDD_CONFIG.cpp
- Committer:
- china_sn0w
- Date:
- 2020-05-28
- Revision:
- 1:7530b7eb757a
File content as of revision 1:7530b7eb757a:
#include "mbed.h" #include "max32630fthr.h" #include "USBSerial.h" #include "I2CSlave.h" #define MCP4561_ADDR 0x5C extern I2C i2c_v; void SetVoltageAVDD(float vol) { uint8_t r_value = 0; uint8_t buf[2]; r_value = 256 - 27/(vol/1.235 - 1.0)/50*256; buf[0] = 0x40; buf[1] = 0x0E; i2c_v.write(MCP4561_ADDR, (char*)buf, 2); buf[0] = 0x00; buf[1] = r_value; i2c_v.write(MCP4561_ADDR, (char*)buf, 2); }