Example program to demonstrate the use of the BatteryChargerBQ24295 class.

Dependencies:   battery-charger-bq24295

Committer:
RobMeades
Date:
Tue Jun 06 08:27:25 2017 +0000
Revision:
0:3594f16acb1e
Child:
1:18ffb01b6380
Initial revision: note that this will NOT compile until mbed 5.5 is published.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RobMeades 0:3594f16acb1e 1 /* mbed Microcontroller Library
RobMeades 0:3594f16acb1e 2 * Copyright (c) 2017 u-blox
RobMeades 0:3594f16acb1e 3 *
RobMeades 0:3594f16acb1e 4 * Licensed under the Apache License, Version 2.0 (the "License");
RobMeades 0:3594f16acb1e 5 * you may not use this file except in compliance with the License.
RobMeades 0:3594f16acb1e 6 * You may obtain a copy of the License at
RobMeades 0:3594f16acb1e 7 *
RobMeades 0:3594f16acb1e 8 * http://www.apache.org/licenses/LICENSE-2.0
RobMeades 0:3594f16acb1e 9 *
RobMeades 0:3594f16acb1e 10 * Unless required by applicable law or agreed to in writing, software
RobMeades 0:3594f16acb1e 11 * distributed under the License is distributed on an "AS IS" BASIS,
RobMeades 0:3594f16acb1e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
RobMeades 0:3594f16acb1e 13 * See the License for the specific language governing permissions and
RobMeades 0:3594f16acb1e 14 * limitations under the License.
RobMeades 0:3594f16acb1e 15 */
RobMeades 0:3594f16acb1e 16
RobMeades 0:3594f16acb1e 17 #include "mbed.h"
RobMeades 0:3594f16acb1e 18 #include "battery_charger_bq24295.h"
RobMeades 0:3594f16acb1e 19
RobMeades 0:3594f16acb1e 20 // LEDs
RobMeades 0:3594f16acb1e 21 DigitalOut ledRed(LED1, 1);
RobMeades 0:3594f16acb1e 22 DigitalOut ledGreen(LED2, 1);
RobMeades 0:3594f16acb1e 23
RobMeades 0:3594f16acb1e 24 /* This example program for the u-blox C030 board instantiates
RobMeades 0:3594f16acb1e 25 * the BQ24295 battery charger interface and performs a few
RobMeades 0:3594f16acb1e 26 * example calls to the battery charger API. Progress may be
RobMeades 0:3594f16acb1e 27 * monitored with a serial terminal running at 9600 baud. The
RobMeades 0:3594f16acb1e 28 * LED on the C030 board will turn green when this program is
RobMeades 0:3594f16acb1e 29 * operating correctly and will turn red if there is a failure.
RobMeades 0:3594f16acb1e 30 */
RobMeades 0:3594f16acb1e 31
RobMeades 0:3594f16acb1e 32 int main()
RobMeades 0:3594f16acb1e 33 {
RobMeades 0:3594f16acb1e 34 BatteryChargerBq24295 charger;
RobMeades 0:3594f16acb1e 35 I2C i2C(I2C_SDA_B, I2C_SCL_B);
RobMeades 0:3594f16acb1e 36
RobMeades 0:3594f16acb1e 37 charger.init(&i2C);
RobMeades 0:3594f16acb1e 38 while (1) {
RobMeades 0:3594f16acb1e 39 ledGreen = 0;
RobMeades 0:3594f16acb1e 40 // Do something
RobMeades 0:3594f16acb1e 41 }
RobMeades 0:3594f16acb1e 42 }
RobMeades 0:3594f16acb1e 43
RobMeades 0:3594f16acb1e 44 // End Of File