Giter VIP home page Giter VIP logo

m5core2_axp192's Introduction

M5Core2 AXP192 Power Management component

This will let you initialise the M5Core2 device. If you do

#include "m5core2_axp192.h"

m5core2_init();

your M5Core2 will do the same things that happen in m5.begin() on Arduino:

I (387) m5core2_axp192: Initialising
I (397) i2c_manager: Starting I2C master at port 0.
I (397) i2c_manager: Initialised port 0 (SDA: 21, SCL: 22, speed: 1000000 Hz.)
I (407) m5core2_axp192: 	Vbus limit off
I (407) m5core2_axp192: 	Speaker amplifier off
I (417) m5core2_axp192: 	RTC battery charging enabled (3v, 200uA)
I (427) m5core2_axp192: 	ESP32 power voltage set to 3.35v
I (427) m5core2_axp192: 	LCD backlight voltage set to 2.80v
I (437) m5core2_axp192: 	LCD logic and sdcard voltage set to 3.3v
I (437) m5core2_axp192: 	Vibrator voltage preset to 2v
I (447) m5core2_axp192: 	LED on
I (447) m5core2_axp192: 	Charge current set to 100 mA
I (457) m5core2_axp192: 	Battery voltage now: 4.18 volts
I (467) m5core2_axp192: 	Power key set, 4 seconds for hard shutdown
I (467) m5core2_axp192: 	Enabled all ADC channels
I (477) m5core2_axp192: 	USB / battery powered, 5V bus on
I (577) m5core2_axp192: 	LCD and touch reset

Presently the following functions are implemented:

esp_err_t m5core2_init();
esp_err_t m5core2_int_5v(bool on);
esp_err_t m5core2_led(bool on);
esp_err_t m5core2_vibration(bool on);
esp_err_t m5core2_speaker(bool on);
esp_err_t m5core2_axp_read_reg(uint8_t reg, uint8_t *buffer);
esp_err_t m5core2_axp_write_reg(uint8_t reg, uint8_t value);
esp_err_t m5core2_axp_read(uint8_t reg, float *buffer);
esp_err_t m5core2_axp_twiddle(uint8_t reg, uint8_t affect, uint8_t value);
esp_err_t m5core2_get_rail_state(axp192_rail_t rail, bool *enabled);
esp_err_t m5core2_set_rail_state(axp192_rail_t rail, bool enabled);
esp_err_t m5core2_get_rail_mv(axp192_rail_t rail, uint16_t *millivolts);
esp_err_t m5core2_set_rail_mv(axp192_rail_t rail, uint16_t millivolts);

This component depends on Mika Tuupola's axp192 and my own i2c_manager. The only menuconfig setting is to say which ESP32 I2C port is used for the internal I2C bus of the M5Core2. To see this component in action, simply follow the instructions at this build-ready demo application.

m5core2_axp192's People

Contributors

ropg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.